Merge remote-tracking branch 'origin/div' into div
| | |
| | | @Resource
|
| | | private AdminUserService adminUserService;
|
| | |
|
| | | @Around("execution(public * com.yeshi.fanli.controller.admin..*.*(..))")
|
| | | // @Around("execution(public * com.yeshi.fanli.controller.admin..*.*(..))")
|
| | | public Object verifyLoginState(ProceedingJoinPoint joinPoint) throws IOException {
|
| | |
|
| | | Signature signature = joinPoint.getSignature();
|
New file |
| | |
| | | package com.yeshi.fanli.controller.admin; |
| | | |
| | | import java.io.PrintWriter; |
| | | import java.math.BigDecimal; |
| | | import java.text.DecimalFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.Calendar; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.yeshi.utils.JsonUtil; |
| | | |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.reflect.TypeToken; |
| | | import com.yeshi.fanli.controller.admin.utils.AdminUtils; |
| | | import com.yeshi.fanli.entity.admin.count.CountOrderInfo; |
| | | import com.yeshi.fanli.entity.admin.count.CountOrderTrackRate; |
| | | import com.yeshi.fanli.entity.admin.count.CountUserInfo; |
| | | import com.yeshi.fanli.service.inter.count.UserInfoCountService; |
| | | import com.yeshi.fanli.service.inter.order.CommonOrderCountService; |
| | | import com.yeshi.fanli.util.MoneyBigDecimalUtil; |
| | | import com.yeshi.fanli.util.StringUtil; |
| | | import com.yeshi.fanli.util.TimeUtil; |
| | | |
| | | import net.sf.json.JSONArray; |
| | | import net.sf.json.JSONObject; |
| | | |
| | | @Controller |
| | | @RequestMapping("admin/new/api/v1/countCharts") |
| | | public class CountChartsAdminController { |
| | | |
| | | @Resource |
| | | private UserInfoCountService userInfoCountService; |
| | | |
| | | @Resource |
| | | private CommonOrderCountService commonOrderCountService; |
| | | |
| | | |
| | | |
| | | private void verifyQueryData(String callback, Integer dateType, String year, String startTime, |
| | | String endTime, PrintWriter out) throws Exception { |
| | | String validateMsg = null; |
| | | if (dateType == null) { |
| | | validateMsg = "请选择视图类型"; |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(validateMsg)); |
| | | return; |
| | | } |
| | | if (dateType == 1 && (StringUtil.isNullOrEmpty(startTime) || StringUtil.isNullOrEmpty(endTime))) { |
| | | validateMsg = "请选择时间区间"; |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(validateMsg)); |
| | | return; |
| | | } |
| | | } |
| | | |
| | | |
| | | private Date getBeginDate(Integer dateType, String year, String startTime) throws Exception{ |
| | | Date beginDate = null; |
| | | if (dateType == 1) { |
| | | beginDate = TimeUtil.parse(startTime); |
| | | } 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(); |
| | | } else if (dateType == 3) { |
| | | beginDate = TimeUtil.parse("2018-01-01"); |
| | | } |
| | | return beginDate; |
| | | } |
| | | |
| | | |
| | | private Date getEndDate(Integer dateType, String year, String endTime) throws Exception{ |
| | | Date endDate = null; |
| | | if (dateType == 1) { |
| | | 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); |
| | | calendar.roll(Calendar.DAY_OF_YEAR, -1); |
| | | endDate=calendar.getTime(); |
| | | } else if (dateType == 3) { |
| | | endDate = new Date(); |
| | | } |
| | | return endDate; |
| | | } |
| | | |
| | | private List<Object> machineOrderResultNum(List<String> dateList, Integer dateType, List<CountOrderInfo> listHistory) { |
| | | List<Object> list = new ArrayList<>(); |
| | | for (String date: dateList) { |
| | | int value = 0; |
| | | if (listHistory != null) { |
| | | for (CountOrderInfo 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; |
| | | } |
| | | |
| | | |
| | | private List<Object> machineOrderResultMoney(List<String> dateList, Integer dateType, List<CountOrderInfo> listHistory) { |
| | | List<Object> list = new ArrayList<>(); |
| | | for (String date: dateList) { |
| | | BigDecimal money = new BigDecimal(0); |
| | | if (listHistory != null) { |
| | | for (CountOrderInfo history: listHistory) { |
| | | if (dateType == 1) { |
| | | String gernalTime = TimeUtil.getGernalTime(history.getDay().getTime()); |
| | | if (gernalTime.equalsIgnoreCase(date)) { |
| | | if (history.getMoney() != null) { |
| | | 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) && history.getMoney() != null) { |
| | | money = MoneyBigDecimalUtil.add(money, history.getMoney()); |
| | | } |
| | | } else if (dateType == 3) { |
| | | String gernalTime = TimeUtil.getYearOnlyYYYY(history.getDay()); |
| | | if (gernalTime.equalsIgnoreCase(date)) { |
| | | if (history.getMoney() != null) { |
| | | money = MoneyBigDecimalUtil.add(money, history.getMoney()); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | list.add(money + ""); |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | private List<Object> machineResultNum(List<String> dateList, Integer dateType, List<CountUserInfo> listHistory) { |
| | | List<Object> list = new ArrayList<>(); |
| | | 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; |
| | | } |
| | | |
| | | /** |
| | | * 统计新人下单情况 |
| | | * @param callback |
| | | * @param channelArray |
| | | * @param dateType 日期类型 |
| | | * @param year |
| | | * @param startTime |
| | | * @param endTime |
| | | * @param countType 统计类型: 1-当日下单 、 2-当周下单、3-当周下3单 |
| | | * @param out |
| | | */ |
| | | @RequestMapping(value = "getNewUserDownOder") |
| | | public void getNewUserDownOder(String callback, String channelArray, Integer dateType, String year, |
| | | String startTime, String endTime, Integer countType, PrintWriter out) { |
| | | try { |
| | | // 数据验证处理 |
| | | verifyQueryData(callback, dateType, year, startTime, endTime, out); |
| | | |
| | | Date beginDate = getBeginDate(dateType, year, startTime); |
| | | Date endDate = getEndDate(dateType, year, endTime); |
| | | |
| | | Gson gson = new Gson(); |
| | | List<String> dateList = AdminUtils.getDateList(dateType, startTime, endTime, year); |
| | | // 渠道 |
| | | List<String> channelList = null; |
| | | if (channelArray != null && channelArray.trim().length() > 4) { |
| | | channelList = gson.fromJson(channelArray, new TypeToken<ArrayList<String>>() {}.getType()); |
| | | } |
| | | |
| | | JSONArray line_list = new JSONArray(); |
| | | if (channelList != null && channelList.size() > 0) { |
| | | for (String channel : channelList) { |
| | | List<CountUserInfo> listData = null; |
| | | if (countType == 1) { |
| | | listData = userInfoCountService.countUserDownOrderByChannelAndToday(channel, beginDate, endDate); |
| | | } else if (countType == 2) { |
| | | listData = userInfoCountService.countUseByChannelAndWeekOrder(channel, beginDate, endDate); |
| | | } else if (countType == 3) { |
| | | listData = userInfoCountService.countUseByChannelAndWeekThreeOrder(channel, beginDate, endDate); |
| | | } |
| | | List<Object> list = machineResultNum(dateList, dateType, listData); |
| | | |
| | | JSONObject innerList = new JSONObject(); |
| | | innerList.put("name", channel); |
| | | innerList.put("data", gson.toJson(list)); |
| | | line_list.add(innerList); |
| | | } |
| | | } else { |
| | | List<CountUserInfo> listData = null; |
| | | if (countType == 1) { |
| | | listData = userInfoCountService.countUserDownOrderByChannelAndToday(null, beginDate, endDate); |
| | | } else if (countType == 2) { |
| | | listData = userInfoCountService.countUseByChannelAndWeekOrder(null, beginDate, endDate); |
| | | } else if (countType == 3) { |
| | | listData = userInfoCountService.countUseByChannelAndWeekThreeOrder(null, beginDate, endDate); |
| | | } |
| | | List<Object> list = machineResultNum(dateList, dateType, listData); |
| | | |
| | | JSONObject innerList = new JSONObject(); |
| | | innerList.put("name", "全部"); |
| | | innerList.put("data", gson.toJson(list)); |
| | | line_list.add(innerList); |
| | | } |
| | | |
| | | 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(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 统计订单情况 |
| | | * @param callback |
| | | * @param channelArray |
| | | * @param dateType |
| | | * @param year |
| | | * @param startTime |
| | | * @param endTime |
| | | * @param countType 1-新用户24小时订单 、 2- 总订单数量 |
| | | * @param out |
| | | */ |
| | | @RequestMapping(value = "getDownOderNum") |
| | | public void getDownOderNum(String callback, String channelArray, Integer dateType, String year, |
| | | String startTime, String endTime, Integer countType, PrintWriter out) { |
| | | try { |
| | | // 数据验证处理 |
| | | verifyQueryData(callback, dateType, year, startTime, endTime, out); |
| | | |
| | | Date beginDate = getBeginDate(dateType, year, startTime); |
| | | Date endDate = getEndDate(dateType, year, endTime); |
| | | |
| | | Gson gson = new Gson(); |
| | | List<String> dateList = AdminUtils.getDateList(dateType, startTime, endTime, year); |
| | | // 渠道 |
| | | List<String> channelList = null; |
| | | if (channelArray != null && channelArray.trim().length() > 4) { |
| | | channelList = gson.fromJson(channelArray, new TypeToken<ArrayList<String>>() {}.getType()); |
| | | } |
| | | |
| | | JSONArray line_list = new JSONArray(); |
| | | if (channelList != null && channelList.size() > 0) { |
| | | for (String channel : channelList) { |
| | | List<CountOrderInfo> listData = null; |
| | | if (countType == 1) { |
| | | listData = userInfoCountService.count24HOderByChannel(channel, beginDate, endDate); |
| | | } else if (countType == 2) { |
| | | listData = userInfoCountService.countOderByChannel(channel, beginDate, endDate); |
| | | } |
| | | List<Object> list = machineOrderResultNum(dateList, dateType, listData); |
| | | |
| | | JSONObject innerList = new JSONObject(); |
| | | innerList.put("name", channel); |
| | | innerList.put("data", gson.toJson(list)); |
| | | line_list.add(innerList); |
| | | } |
| | | } else { |
| | | List<CountOrderInfo> listData = null; |
| | | if (countType == 1) { |
| | | listData = userInfoCountService.count24HOderByChannel(null, beginDate, endDate); |
| | | } else if (countType == 2) { |
| | | listData = userInfoCountService.countOderByChannel(null, beginDate, endDate); |
| | | } |
| | | List<Object> list = machineOrderResultNum(dateList, dateType, listData); |
| | | |
| | | JSONObject innerList = new JSONObject(); |
| | | innerList.put("name", "全部"); |
| | | innerList.put("data", gson.toJson(list)); |
| | | line_list.add(innerList); |
| | | } |
| | | |
| | | 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(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 统计订单佣金 |
| | | * @param callback |
| | | * @param channelArray |
| | | * @param dateType |
| | | * @param year |
| | | * @param startTime |
| | | * @param endTime |
| | | * @param out |
| | | */ |
| | | @RequestMapping(value = "getCommissionMoney") |
| | | public void getCommissionMoney(String callback, String channelArray, Integer dateType, String year, |
| | | String startTime, String endTime, PrintWriter out) { |
| | | try { |
| | | // 数据验证处理 |
| | | verifyQueryData(callback, dateType, year, startTime, endTime, out); |
| | | |
| | | Date beginDate = getBeginDate(dateType, year, startTime); |
| | | Date endDate = getEndDate(dateType, year, endTime); |
| | | |
| | | Gson gson = new Gson(); |
| | | List<String> dateList = AdminUtils.getDateList(dateType, startTime, endTime, year); |
| | | // 渠道 |
| | | List<String> channelList = null; |
| | | if (channelArray != null && channelArray.trim().length() > 4) { |
| | | channelList = gson.fromJson(channelArray, new TypeToken<ArrayList<String>>() {}.getType()); |
| | | } |
| | | |
| | | JSONArray line_list = new JSONArray(); |
| | | if (channelList != null && channelList.size() > 0) { |
| | | for (String channel : channelList) { |
| | | List<CountOrderInfo> listData = userInfoCountService.countHongBaoByChannel(channel, beginDate, endDate); |
| | | List<Object> list = machineOrderResultMoney(dateList, dateType, listData); |
| | | JSONObject innerList = new JSONObject(); |
| | | innerList.put("name", channel); |
| | | innerList.put("data", gson.toJson(list)); |
| | | line_list.add(innerList); |
| | | } |
| | | } else { |
| | | List<CountOrderInfo> listData = userInfoCountService.countHongBaoByChannel(null, beginDate, endDate); |
| | | List<Object> list = machineOrderResultMoney(dateList, dateType, listData); |
| | | JSONObject innerList = new JSONObject(); |
| | | innerList.put("name", "全部"); |
| | | innerList.put("data", gson.toJson(list)); |
| | | line_list.add(innerList); |
| | | } |
| | | |
| | | 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(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 统计订单佣金 |
| | | * @param callback |
| | | * @param channelArray |
| | | * @param dateType |
| | | * @param year |
| | | * @param startTime |
| | | * @param endTime |
| | | * @param out |
| | | */ |
| | | @RequestMapping(value = "getOrderTypeNum") |
| | | public void getOrderTypeNum(String callback, String typeArray, Integer dateType, String year, |
| | | String startTime, String endTime, Integer countType, PrintWriter out) { |
| | | try { |
| | | // 数据验证处理 |
| | | verifyQueryData(callback, dateType, year, startTime, endTime, out); |
| | | |
| | | Date beginDate = getBeginDate(dateType, year, startTime); |
| | | Date endDate = getEndDate(dateType, year, endTime); |
| | | |
| | | Gson gson = new Gson(); |
| | | List<String> dateList = AdminUtils.getDateList(dateType, startTime, endTime, year); |
| | | // 渠道 |
| | | List<Integer> typeList = null; |
| | | if (typeArray != null && typeArray.trim().length() > 4) { |
| | | typeList = gson.fromJson(typeArray, new TypeToken<ArrayList<Integer>>() {}.getType()); |
| | | } |
| | | |
| | | JSONArray line_list = new JSONArray(); |
| | | if (typeList != null && typeList.size() > 0) { |
| | | for (Integer type : typeList) { |
| | | List<CountOrderInfo> listData = userInfoCountService.countOrderType(type, beginDate, endDate); |
| | | List<Object> list = machineOrderResultMoney(dateList, dateType, listData); |
| | | JSONObject innerList = new JSONObject(); |
| | | |
| | | String name = ""; |
| | | if (type == 1) { |
| | | name = "自购订单"; |
| | | } else if (type == 2) { |
| | | name = "分享订单"; |
| | | } else if (type == 3) { |
| | | name = "邀请订单"; |
| | | } |
| | | innerList.put("name", name); |
| | | innerList.put("data", gson.toJson(list)); |
| | | line_list.add(innerList); |
| | | } |
| | | } else { |
| | | List<CountOrderInfo> listData = userInfoCountService.countOrderType(null, beginDate, endDate); |
| | | List<Object> list = machineOrderResultMoney(dateList, dateType, listData); |
| | | JSONObject innerList = new JSONObject(); |
| | | innerList.put("name", "全部"); |
| | | innerList.put("data", gson.toJson(list)); |
| | | line_list.add(innerList); |
| | | } |
| | | |
| | | 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(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 维权订单 金额、订单号数量 |
| | | * @param callback |
| | | * @param channelArray |
| | | * @param dateType |
| | | * @param year |
| | | * @param startTime |
| | | * @param endTime |
| | | * @param out |
| | | */ |
| | | @RequestMapping(value = "getWeiQuanOrderInfo") |
| | | public void getWeiQuanOrderInfo(String callback, Integer dateType, String year, |
| | | String startTime, String endTime, Integer countType, PrintWriter out) { |
| | | try { |
| | | // 数据验证处理 |
| | | verifyQueryData(callback, dateType, year, startTime, endTime, out); |
| | | |
| | | Date beginDate = getBeginDate(dateType, year, startTime); |
| | | Date endDate = getEndDate(dateType, year, endTime); |
| | | |
| | | Gson gson = new Gson(); |
| | | List<String> dateList = AdminUtils.getDateList(dateType, startTime, endTime, year); |
| | | |
| | | JSONArray line_list = new JSONArray(); |
| | | |
| | | List<Object> list = null; |
| | | String name = ""; |
| | | if (countType == 1) { |
| | | name = "维权数量"; |
| | | List<CountOrderInfo> listData = userInfoCountService.countWeiQuanOrder(beginDate, endDate); |
| | | list = machineOrderResultNum(dateList, dateType, listData); |
| | | } else if (countType == 2) { |
| | | name = "维权金额"; |
| | | List<CountOrderInfo> listData = userInfoCountService.countWeiQuanOrderMoney(beginDate, endDate); |
| | | list = machineOrderResultMoney(dateList, dateType, listData); |
| | | } |
| | | |
| | | JSONObject innerList = new JSONObject(); |
| | | innerList.put("name", name); |
| | | innerList.put("data", gson.toJson(list)); |
| | | line_list.add(innerList); |
| | | |
| | | 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(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 订单找回 金额、订单号数量 |
| | | * @param callback |
| | | * @param channelArray |
| | | * @param dateType |
| | | * @param year |
| | | * @param startTime |
| | | * @param endTime |
| | | * @param out |
| | | */ |
| | | @RequestMapping(value = "getLostOrderInfo") |
| | | public void getLostOrderInfo(String callback, Integer dateType, String year, |
| | | String startTime, String endTime, Integer countType, PrintWriter out) { |
| | | try { |
| | | // 数据验证处理 |
| | | verifyQueryData(callback, dateType, year, startTime, endTime, out); |
| | | |
| | | Date beginDate = getBeginDate(dateType, year, startTime); |
| | | Date endDate = getEndDate(dateType, year, endTime); |
| | | |
| | | Gson gson = new Gson(); |
| | | List<String> dateList = AdminUtils.getDateList(dateType, startTime, endTime, year); |
| | | |
| | | JSONArray line_list = new JSONArray(); |
| | | |
| | | List<Object> list = null; |
| | | String name = ""; |
| | | if (countType == 1) { |
| | | name = "申诉数量"; |
| | | List<CountOrderInfo> listData = userInfoCountService.counOrderLastNum(beginDate, endDate); |
| | | list = machineOrderResultNum(dateList, dateType, listData); |
| | | } else if (countType == 2) { |
| | | name = "申诉佣金"; |
| | | List<CountOrderInfo> listData = userInfoCountService.counOrderLastMoney(beginDate, endDate); |
| | | list = machineOrderResultMoney(dateList, dateType, listData); |
| | | } |
| | | |
| | | JSONObject innerList = new JSONObject(); |
| | | innerList.put("name", name); |
| | | innerList.put("data", gson.toJson(list)); |
| | | line_list.add(innerList); |
| | | |
| | | 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(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 订单找回 金额、订单号数量 |
| | | * @param callback |
| | | * @param channelArray |
| | | * @param dateType |
| | | * @param year |
| | | * @param startTime |
| | | * @param endTime |
| | | * @param out |
| | | */ |
| | | @RequestMapping(value = "getOrderCount") |
| | | public void getOrderCount(String callback, Integer dateType, String year, String startTime, String endTime, |
| | | Integer countType, PrintWriter out) { |
| | | try { |
| | | // 数据验证处理 |
| | | verifyQueryData(callback, dateType, year, startTime, endTime, out); |
| | | |
| | | Date beginDate = getBeginDate(dateType, year, startTime); |
| | | Date endDate = getEndDate(dateType, year, endTime); |
| | | |
| | | Gson gson = new Gson(); |
| | | List<String> dateList = AdminUtils.getDateList(dateType, startTime, endTime, year); |
| | | |
| | | JSONArray line_list = new JSONArray(); |
| | | |
| | | List<Object> list = null; |
| | | String name = ""; |
| | | if (countType == 1) { |
| | | name = "单数"; |
| | | List<CountOrderInfo> listData = userInfoCountService.counOrderTotalNum(beginDate, endDate); |
| | | list = machineOrderResultNum(dateList, dateType, listData); |
| | | } else if (countType == 2) { |
| | | name = "佣金"; |
| | | List<CountOrderInfo> listData = userInfoCountService.counOrderTotalCommission(beginDate, endDate); |
| | | list = machineOrderResultMoney(dateList, dateType, listData); |
| | | } |
| | | |
| | | JSONObject innerList = new JSONObject(); |
| | | innerList.put("name", name); |
| | | innerList.put("data", gson.toJson(list)); |
| | | line_list.add(innerList); |
| | | |
| | | 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(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 订单跟踪率 |
| | | * @param callback |
| | | * @param channelArray |
| | | * @param dateType |
| | | * @param year |
| | | * @param startTime |
| | | * @param endTime |
| | | * @param out |
| | | */ |
| | | @RequestMapping(value = "getOrderTrackRate") |
| | | public void getOrderTrackRate(String callback, Integer dateType, String year, String startTime, String endTime, |
| | | Integer countType, PrintWriter out) { |
| | | try { |
| | | // 数据验证处理 |
| | | verifyQueryData(callback, dateType, year, startTime, endTime, out); |
| | | |
| | | Date beginDate = getBeginDate(dateType, year, startTime); |
| | | Date endDate = getEndDate(dateType, year, endTime); |
| | | |
| | | Gson gson = new Gson(); |
| | | List<String> dateList = AdminUtils.getDateList(dateType, startTime, endTime, year); |
| | | |
| | | JSONArray line_list = new JSONArray(); |
| | | |
| | | List<CountOrderTrackRate> listHistory = commonOrderCountService.getOrderTrackRate(countType, beginDate, endDate); |
| | | |
| | | List<Object> list = new ArrayList<>(); |
| | | DecimalFormat df = new DecimalFormat("#.00"); |
| | | for (String date: dateList) { |
| | | double proportion = 0; |
| | | if (listHistory != null) { |
| | | Long upValue = 0L; |
| | | Long downValue = 0L; |
| | | for (CountOrderTrackRate history: listHistory) { |
| | | if (dateType == 1) { |
| | | String gernalTime = TimeUtil.getGernalTime(history.getDay().getTime()); |
| | | if (gernalTime.equalsIgnoreCase(date)) { |
| | | if(history.getNum() != null) |
| | | upValue = history.getNum(); |
| | | if(history.getTotalNum() != null) |
| | | downValue = history.getTotalNum(); |
| | | continue; |
| | | } |
| | | } else if (dateType == 2){ |
| | | String gernalTime = TimeUtil.getMonthOnlyMM(history.getDay()); |
| | | if(gernalTime.startsWith("0")) { |
| | | gernalTime = gernalTime.substring(1, 2); |
| | | } |
| | | |
| | | if (gernalTime.equalsIgnoreCase(date)) { |
| | | if(history.getNum() != null) |
| | | upValue = history.getNum(); |
| | | if(history.getTotalNum() != null) |
| | | downValue = history.getTotalNum(); |
| | | continue; |
| | | } |
| | | } else if (dateType == 3) { |
| | | String gernalTime = TimeUtil.getYearOnlyYYYY(history.getDay()); |
| | | if (gernalTime.equalsIgnoreCase(date)) { |
| | | if(history.getNum() != null) |
| | | upValue = history.getNum(); |
| | | if(history.getTotalNum() != null) |
| | | downValue = history.getTotalNum(); |
| | | continue; |
| | | } |
| | | } |
| | | } |
| | | if(downValue != 0) { |
| | | proportion = upValue / (double) downValue; |
| | | } |
| | | } |
| | | list.add(Double.parseDouble(df.format(proportion * 100)) + ""); |
| | | } |
| | | |
| | | JSONObject innerList = new JSONObject(); |
| | | innerList.put("name", "跟踪率"); |
| | | innerList.put("data", gson.toJson(list)); |
| | | line_list.add(innerList); |
| | | |
| | | 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(); |
| | | } |
| | | } |
| | | } |
| | |
| | | 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.service.inter.user.UserInfoExtraService;
|
| | | import com.yeshi.fanli.tag.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;
|
| | |
| | | @RequestMapping(value = "getAuditTotal")
|
| | | public void getAuditTotal(String callback, String stateArray, Integer dateType, String year, String startTime,
|
| | | String endTime, PrintWriter out) {
|
| | |
|
| | | String validateMsg = AdminUtils.validateParams(dateType, startTime, endTime);
|
| | | if (validateMsg != null) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(validateMsg));
|
| | | return;
|
| | | }
|
| | |
|
| | | if (dateType == 1 && year != null) {
|
| | | year = null; // 设置为空
|
| | | } else if (dateType == 2) {
|
| | | if (startTime != null)
|
| | | startTime = null;
|
| | |
|
| | | if (endTime != null)
|
| | | endTime = null;
|
| | |
|
| | | } else if (dateType == 3) {
|
| | | if (year != null)
|
| | | year = null;
|
| | |
|
| | | if (startTime != null)
|
| | | startTime = null;
|
| | |
|
| | | if (endTime != null)
|
| | | endTime = null;
|
| | | }
|
| | |
|
| | | try {
|
| | | Object objectDate = null;
|
| | | List<String> dateList = AdminUtils.getDateList(dateType, startTime, endTime, year);
|
| | | 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;
|
| | | }
|
| | |
|
| | | 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<Integer> stateList = gson.fromJson(stateArray, new TypeToken<ArrayList<Integer>>() {
|
| | | }.getType());
|
| | |
|
| | | 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();
|
| | | for (Integer state : stateList) {
|
| | | JSONObject innerList = new JSONObject();
|
| | | if (state == null || state == 3) {
|
| | | innerList.put("name", "总计");
|
| | | } else if (state == 1) {
|
| | | innerList.put("name", "通过数");
|
| | | } else if (state == 2) {
|
| | | innerList.put("name", "驳回数");
|
| | | }
|
| | |
|
| | | List<ChartTDO> list = extractAuditRecordService.countAuditTotal(state, dateType, year, startTime,
|
| | | endTime);
|
| | | if (dateType != 3) {
|
| | | innerList.put("data", gson.toJson(AdminUtils.dayOrMonthDataFactory(dateType, dateList, list)));
|
| | | } else {
|
| | | // 年视图
|
| | | Map<String, Object> map = AdminUtils.yearsDataFactory(list);
|
| | |
|
| | | if (objectDate == null) {
|
| | | objectDate = map.get("date");
|
| | | |
| | | 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 = "驳回";
|
| | | }
|
| | | innerList.put("data", gson.toJson(map.get("value")));
|
| | | 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);
|
| | | }
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | if (objectDate != null) {
|
| | | data.put("xAxis_list", gson.toJson(objectDate));
|
| | | } else {
|
| | | data.put("xAxis_list", gson.toJson(dateList));
|
| | | }
|
| | |
|
| | | 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("操作异常"));
|
| | | 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;
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | @RequestMapping(value = "getExtractApplyMoney")
|
| | | public void getExtractApplyMoney(String callback, Integer dateType, String year, String startTime, String endTime,
|
| | | PrintWriter out) {
|
| | | String validateMsg = AdminUtils.validateParams(dateType, startTime, endTime);
|
| | | if (validateMsg != null) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(validateMsg));
|
| | | return;
|
| | | }
|
| | |
|
| | | if (dateType == 1 && year != null) {
|
| | | year = null; // 设置为空
|
| | | } else if (dateType == 2) {
|
| | | if (startTime != null)
|
| | | startTime = null;
|
| | |
|
| | | if (endTime != null)
|
| | | endTime = null;
|
| | |
|
| | | } else if (dateType == 3) {
|
| | | if (year != null)
|
| | | year = null;
|
| | |
|
| | | if (startTime != null)
|
| | | startTime = null;
|
| | |
|
| | | if (endTime != null)
|
| | | endTime = null;
|
| | | }
|
| | |
|
| | | try {
|
| | |
|
| | | Object objectDate = null;
|
| | | List<String> dateList = AdminUtils.getDateList(dateType, startTime, endTime, year);
|
| | |
|
| | | Gson gson = new Gson();
|
| | | JSONObject innerList = new JSONObject();
|
| | | innerList.put("name", "总计");
|
| | |
|
| | | List<ChartTDO> list = extractAuditRecordService.countExtractApplyMoney(null, dateType, year, startTime,
|
| | | endTime);
|
| | |
|
| | | if (dateType != 3) {
|
| | | innerList.put("data", gson.toJson(AdminUtils.dayOrMonthDataFactory(dateType, dateList, list)));
|
| | | } else {
|
| | | // 年视图
|
| | | Map<String, Object> map = AdminUtils.yearsDataFactory(list);
|
| | |
|
| | | if (objectDate == null) {
|
| | | objectDate = map.get("date");
|
| | | }
|
| | | innerList.put("data", gson.toJson(map.get("value")));
|
| | | 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;
|
| | | }
|
| | |
|
| | | 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));
|
| | |
|
| | | JSONArray line_list = new JSONArray();
|
| | | line_list.add(innerList);
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | if (objectDate != null) {
|
| | | data.put("xAxis_list", gson.toJson(objectDate));
|
| | | } else {
|
| | | data.put("xAxis_list", gson.toJson(dateList));
|
| | | }
|
| | |
|
| | | data.put("xAxis_list", gson.toJson(dateList));
|
| | | data.put("line_list", line_list);
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
|
| | | } catch (Exception e) {
|
| | |
| | | @RequestMapping(value = "getExtractApplyNumber")
|
| | | public void getExtractApplyNumber(String callback, Integer state, Integer dateType, String year, String startTime,
|
| | | String endTime, PrintWriter out) {
|
| | | String validateMsg = AdminUtils.validateParams(dateType, startTime, endTime);
|
| | | if (validateMsg != null) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(validateMsg));
|
| | | return;
|
| | | }
|
| | |
|
| | | if (dateType == 1 && year != null) {
|
| | | year = null; // 设置为空
|
| | | } else if (dateType == 2) {
|
| | | if (startTime != null)
|
| | | startTime = null;
|
| | |
|
| | | if (endTime != null)
|
| | | endTime = null;
|
| | |
|
| | | } else if (dateType == 3) {
|
| | | if (year != null)
|
| | | year = null;
|
| | |
|
| | | if (startTime != null)
|
| | | startTime = null;
|
| | |
|
| | | if (endTime != null)
|
| | | endTime = null;
|
| | | }
|
| | |
|
| | | try {
|
| | | Object objectDate = null;
|
| | | 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;
|
| | | }
|
| | |
|
| | | |
| | | 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);
|
| | |
|
| | | JSONObject innerList = new JSONObject();
|
| | | innerList.put("name", "总计");
|
| | |
|
| | | List<ChartTDO> list = extractAuditRecordService.countExtractApplyNumber(null, dateType, year, startTime,
|
| | | endTime);
|
| | |
|
| | | if (dateType != 3) {
|
| | | innerList.put("data", gson.toJson(AdminUtils.dayOrMonthDataFactory(dateType, dateList, list)));
|
| | | } else {
|
| | | // 年视图
|
| | | Map<String, Object> map = AdminUtils.yearsDataFactory(list);
|
| | |
|
| | | if (objectDate == null) {
|
| | | objectDate = map.get("date");
|
| | | |
| | | 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;
|
| | | }
|
| | | innerList.put("data", gson.toJson(map.get("value")));
|
| | | |
| | | 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));
|
| | |
|
| | | JSONArray line_list = new JSONArray();
|
| | | line_list.add(innerList);
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | if (objectDate != null) {
|
| | | data.put("xAxis_list", gson.toJson(objectDate));
|
| | | } else {
|
| | | data.put("xAxis_list", gson.toJson(dateList));
|
| | | }
|
| | |
|
| | | 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("操作异常"));
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("系统异常"));
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.controller.admin; |
| | | |
| | | import java.io.PrintWriter; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.multipart.MultipartHttpServletRequest; |
| | | import org.yeshi.utils.JsonUtil; |
| | | |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.GsonBuilder; |
| | | import com.google.gson.reflect.TypeToken; |
| | | import com.yeshi.fanli.entity.dynamic.CommentInfo; |
| | | import com.yeshi.fanli.entity.dynamic.GoodsEvaluate; |
| | | import com.yeshi.fanli.entity.dynamic.ImgInfo; |
| | | import com.yeshi.fanli.entity.dynamic.ImgInfo.ImgEnum; |
| | | import com.yeshi.fanli.exception.dynamic.GoodsEvaluateException; |
| | | import com.yeshi.fanli.service.inter.dynamic.GoodsEvaluateService; |
| | | import com.yeshi.fanli.service.inter.order.config.HongBaoManageService; |
| | | import com.yeshi.fanli.service.manger.ClipboardAnalysisManager; |
| | | import com.yeshi.fanli.tag.PageEntity; |
| | | import com.yeshi.fanli.util.Constant; |
| | | import com.yeshi.fanli.util.RedisManager; |
| | | import com.yeshi.fanli.util.StringUtil; |
| | | import com.yeshi.fanli.util.TimeUtil; |
| | | import com.yeshi.fanli.util.cache.JDGoodsCacheUtil; |
| | | import com.yeshi.fanli.util.cache.PinDuoDuoCacheUtil; |
| | | import com.yeshi.fanli.vo.goods.GoodsDetailVO; |
| | | |
| | | import net.sf.json.JSONObject; |
| | | |
| | | /** |
| | | * 轮播图管理 |
| | | * |
| | | * @author Administrator |
| | | * |
| | | */ |
| | | @Controller |
| | | @RequestMapping("admin/new/api/v1/evaluate") |
| | | public class GoodsEvaluateAdminController { |
| | | |
| | | @Resource |
| | | private GoodsEvaluateService goodsEvaluateService; |
| | | |
| | | @Resource |
| | | private ClipboardAnalysisManager clipboardAnalysisManager; |
| | | |
| | | @Resource |
| | | private RedisManager redisManager; |
| | | |
| | | @Resource |
| | | private JDGoodsCacheUtil jdGoodsCacheUtil; |
| | | |
| | | @Resource |
| | | private PinDuoDuoCacheUtil pinDuoDuoCacheUtil; |
| | | |
| | | @Resource |
| | | private HongBaoManageService hongBaoManageService; |
| | | |
| | | /** |
| | | * 保存信息 |
| | | * |
| | | * @param callback |
| | | * @param special |
| | | * @param out |
| | | */ |
| | | @RequestMapping(value = "saveHead") |
| | | public void saveHead(String callback, GoodsEvaluate evaluate, HttpServletRequest request, PrintWriter out) { |
| | | try { |
| | | if (request instanceof MultipartHttpServletRequest) { |
| | | MultipartHttpServletRequest fileRequest = (MultipartHttpServletRequest) request; |
| | | goodsEvaluateService.saveHead(fileRequest.getFile("portraitFile"), evaluate); |
| | | } else { |
| | | goodsEvaluateService.saveHead(null, evaluate); |
| | | } |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("保存成功")); |
| | | } catch (GoodsEvaluateException e) { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMsg())); |
| | | } catch (Exception e) { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("保存失败")); |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 保存信息 |
| | | * |
| | | * @param callback |
| | | * @param special |
| | | * 0a39676f138c4dcba722e321d43c4284 |
| | | * @param out |
| | | */ |
| | | @RequestMapping(value = "saveSingleGoods") |
| | | public void saveSingleGoods(String callback, String pid, Long goodsId, Integer goodsType, String videoUrl, |
| | | Integer picNum, String picUrls, HttpServletRequest request, PrintWriter out) { |
| | | try { |
| | | MultipartHttpServletRequest fileRequest = null; |
| | | if (request instanceof MultipartHttpServletRequest) { |
| | | fileRequest = (MultipartHttpServletRequest) request; |
| | | } |
| | | goodsEvaluateService.saveSingleGoods(pid, goodsId, goodsType, videoUrl, picNum, picUrls, fileRequest); |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("保存成功")); |
| | | } catch (GoodsEvaluateException e) { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMsg())); |
| | | } catch (Exception e) { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("保存失败")); |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 保存信息 |
| | | * |
| | | * @param callback |
| | | * @param special |
| | | * 0a39676f138c4dcba722e321d43c4284 |
| | | * @param out |
| | | */ |
| | | @RequestMapping(value = "saveSingleGoodsCoupon") |
| | | public void saveSingleGoodsCoupon(String callback, String pid, CommentInfo commentInfo, PrintWriter out) { |
| | | try { |
| | | goodsEvaluateService.saveSingleGoodsCoupon(pid, commentInfo); |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("保存成功")); |
| | | } catch (GoodsEvaluateException e) { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMsg())); |
| | | } catch (Exception e) { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("保存失败")); |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取信息 |
| | | * |
| | | * @param callback |
| | | * @param special |
| | | * 0a39676f138c4dcba722e321d43c4284 |
| | | * @param out |
| | | */ |
| | | @RequestMapping(value = "getSingleGoodsinfo") |
| | | public void getSingleGoodsinfo(String callback, String pid, PrintWriter out) { |
| | | try { |
| | | String goodsId = ""; |
| | | String goodsType = ""; |
| | | String videoUrl = ""; |
| | | String videoPic = ""; |
| | | Integer picNum = 1; |
| | | List<String> list = new ArrayList<String>(); |
| | | GoodsEvaluate goodsEvaluate = goodsEvaluateService.getById(pid); |
| | | if (goodsEvaluate != null && goodsEvaluate.getImgList() != null && goodsEvaluate.getImgList().size() > 0) { |
| | | List<ImgInfo> imgList = goodsEvaluate.getImgList(); |
| | | for (ImgInfo imgInfo : imgList) { |
| | | ImgEnum type = imgInfo.getType(); |
| | | if (type == ImgEnum.video) { |
| | | videoPic = imgInfo.getUrl(); |
| | | videoUrl = imgInfo.getVideoUrl(); |
| | | } else if (type == ImgEnum.goods) { |
| | | list.add(imgInfo.getUrl()); |
| | | goodsId = imgInfo.getGoods().getGoodsId().toString(); |
| | | goodsType = imgInfo.getGoods().getGoodsType().toString(); |
| | | } else if (type == ImgEnum.img) { |
| | | list.add(imgInfo.getUrl()); |
| | | } |
| | | } |
| | | picNum = goodsEvaluate.getMainPicNum(); |
| | | } |
| | | |
| | | JSONObject data = new JSONObject(); |
| | | data.put("goodsId", goodsId); |
| | | data.put("goodsType", goodsType); |
| | | data.put("videoUrl", videoUrl); |
| | | data.put("videoPic", videoPic); |
| | | data.put("picNum", picNum); |
| | | data.put("list", list); |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data)); |
| | | } catch (Exception e) { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("查询失败")); |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取信息 |
| | | * |
| | | * @param callback |
| | | * @param special |
| | | * 0a39676f138c4dcba722e321d43c4284 |
| | | * @param out |
| | | */ |
| | | @RequestMapping(value = "getSingleGoodsCoupon") |
| | | public void getSingleGoodsCoupon(String callback, String pid, PrintWriter out) { |
| | | try { |
| | | CommentInfo commentInfo = new CommentInfo(); |
| | | GoodsEvaluate goodsEvaluate = goodsEvaluateService.getById(pid); |
| | | if (goodsEvaluate != null && goodsEvaluate.getComments() != null && goodsEvaluate.getComments().size() > 0) { |
| | | commentInfo = goodsEvaluate.getComments().get(0); |
| | | } |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(commentInfo)); |
| | | } catch (Exception e) { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("查询失败")); |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 保存信息 |
| | | * |
| | | * @param callback |
| | | * @param special |
| | | * 0a39676f138c4dcba722e321d43c4284 |
| | | * @param out |
| | | */ |
| | | @RequestMapping(value = "saveActivityPic") |
| | | public void saveActivityPic(String callback, String pid, ImgInfo imgInfo, |
| | | HttpServletRequest request, PrintWriter out) { |
| | | try { |
| | | MultipartHttpServletRequest fileRequest = null; |
| | | if (request instanceof MultipartHttpServletRequest) { |
| | | fileRequest = (MultipartHttpServletRequest) request; |
| | | } |
| | | goodsEvaluateService.saveActivityPic(pid, imgInfo, fileRequest); |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("保存成功")); |
| | | } catch (GoodsEvaluateException e) { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMsg())); |
| | | } catch (Exception e) { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("保存失败")); |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取信息 |
| | | * |
| | | * @param callback |
| | | * @param special |
| | | * 0a39676f138c4dcba722e321d43c4284 |
| | | * @param out |
| | | */ |
| | | @RequestMapping(value = "getActivityPic") |
| | | public void getActivityPic(String callback, String pid, PrintWriter out) { |
| | | try { |
| | | String videoPic = ""; |
| | | String videoUrl = ""; |
| | | String activityPic = ""; |
| | | String activityUrl = ""; |
| | | GoodsEvaluate goodsEvaluate = goodsEvaluateService.getById(pid); |
| | | if (goodsEvaluate != null && goodsEvaluate.getImgList() != null && goodsEvaluate.getImgList().size() > 0) { |
| | | List<ImgInfo> imgList = goodsEvaluate.getImgList(); |
| | | for (ImgInfo imgInfo : imgList) { |
| | | ImgEnum type = imgInfo.getType(); |
| | | if (type == ImgEnum.video) { |
| | | videoPic = imgInfo.getUrl(); |
| | | videoUrl = imgInfo.getVideoUrl(); |
| | | } else if (type == ImgEnum.activity) { |
| | | activityPic = imgInfo.getUrl(); |
| | | activityUrl = imgInfo.getActivityUrl(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | JSONObject data = new JSONObject(); |
| | | data.put("videoUrl", videoUrl); |
| | | data.put("videoPic", videoPic); |
| | | data.put("activityPic", activityPic); |
| | | data.put("activityUrl", activityUrl); |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data)); |
| | | } catch (Exception e) { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("查询失败")); |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 保存信息 |
| | | * |
| | | * @param callback |
| | | * @param special |
| | | * @param out |
| | | */ |
| | | @RequestMapping(value = "getEvaluate") |
| | | public void getEvaluate(String callback, String id, PrintWriter out) { |
| | | try { |
| | | GoodsEvaluate goodsEvaluate = goodsEvaluateService.getById(id); |
| | | if (goodsEvaluate == null) |
| | | goodsEvaluate = new GoodsEvaluate(); |
| | | |
| | | GsonBuilder gsonBuilder = new GsonBuilder(); |
| | | gsonBuilder.serializeNulls(); |
| | | Gson gson = gsonBuilder.setDateFormat("yyyy-MM-dd HH:mm:ss").create(); |
| | | |
| | | JSONObject data = new JSONObject(); |
| | | data.put("result", gson.toJson(goodsEvaluate)); |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data)); |
| | | } catch (Exception e) { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("查询失败")); |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 删除图片以及信息 |
| | | * |
| | | * @param callback |
| | | * @param idArray |
| | | * @param out |
| | | */ |
| | | @RequestMapping(value = "delete") |
| | | public void delete(String callback, String idArray, PrintWriter out) { |
| | | try { |
| | | if (StringUtil.isNullOrEmpty(idArray)) { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("请选择操作的数据")); |
| | | return; |
| | | } |
| | | Gson gson = new Gson(); |
| | | List<String> list = gson.fromJson(idArray, new TypeToken<ArrayList<String>>() { |
| | | }.getType()); |
| | | |
| | | if (list == null || list.size() == 0) { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("未检测到删除的数据")); |
| | | return; |
| | | } |
| | | |
| | | goodsEvaluateService.deleteBatchByPrimaryKey(list); |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("删除成功")); |
| | | } catch (Exception e) { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("删除失败")); |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 查询 |
| | | * |
| | | * @param callback |
| | | * @param pageIndex |
| | | * @param pageSize |
| | | * @param bannerId |
| | | * @param out |
| | | */ |
| | | @RequestMapping(value = "query") |
| | | public void query(String callback, Integer pageIndex, Integer pageSize, String key, Integer state, |
| | | PrintWriter out) { |
| | | if (pageIndex == null || pageIndex < 1) { |
| | | pageIndex = 1; |
| | | } |
| | | if (pageSize == null || pageSize < 1) { |
| | | pageSize = Constant.PAGE_SIZE; |
| | | } |
| | | |
| | | try { |
| | | List<GoodsEvaluate> list = goodsEvaluateService.query((pageIndex - 1) * pageSize, pageSize, key, state); |
| | | if (list == null || list.size() == 0) { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("暂无数据")); |
| | | return; |
| | | } |
| | | |
| | | for (GoodsEvaluate article : list) { |
| | | Date startTime = article.getStartTime(); |
| | | if (startTime == null) { |
| | | article.setStartTimeChar(""); |
| | | } else { |
| | | article.setStartTimeChar(TimeUtil.formatDateAddT(startTime)); |
| | | } |
| | | |
| | | Date endTime = article.getEndTime(); |
| | | if (endTime == null) { |
| | | article.setEndTimeChar(""); |
| | | } else { |
| | | article.setEndTimeChar(TimeUtil.formatDateAddT(endTime)); |
| | | } |
| | | } |
| | | |
| | | long count = goodsEvaluateService.count(key, state); |
| | | |
| | | int totalPage = (int) (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", list); |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data)); |
| | | } catch (Exception e) { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作异常")); |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 根据链接查询商品 |
| | | * |
| | | * @param callback |
| | | * @param text |
| | | * @param out |
| | | */ |
| | | @RequestMapping(value = "getGoodsByUrl") |
| | | public void getGoodsByUrl(String callback, String link, PrintWriter out) { |
| | | try { |
| | | // CommonGoods commonGoods = |
| | | // clipboardAnalysisManager.parseLink(link); |
| | | // if (commonGoods == null) { |
| | | // JsonUtil.printMode(out, callback, |
| | | // JsonUtil.loadFalseResult("未找到该商品")); |
| | | // return; |
| | | // } |
| | | // |
| | | GoodsDetailVO goodsDetail = null; |
| | | |
| | | // try { |
| | | // BigDecimal fanLiRate = hongBaoManageService.getFanLiRate(); |
| | | // BigDecimal shareRate = hongBaoManageService.getShareRate(); |
| | | // BigDecimal vipFanLiRate = hongBaoManageService.getVIPFanLiRate(); |
| | | // ConfigParamsDTO params = new ConfigParamsDTO(fanLiRate, |
| | | // shareRate, Constant.MAX_REWARD_RATE, vipFanLiRate); |
| | | // TaoBaoGoodsBrief goodsBrief = |
| | | // redisManager.getTaoBaoGoodsBrief(596617470742L); |
| | | // goodsDetail = GoodsDetailVOFactory.convertTaoBao(goodsBrief, |
| | | // params); |
| | | // } catch (TaobaoGoodsDownException e) { |
| | | // JsonUtil.printMode(out, callback, |
| | | // JsonUtil.loadFalseResult("该商品已下架")); |
| | | // return; |
| | | // } |
| | | |
| | | |
| | | // if (commonGoods.getGoodsType() == Constant.SOURCE_TYPE_TAOBAO) { |
| | | // try { |
| | | // TaoBaoGoodsBrief goodsBrief = |
| | | // redisManager.getTaoBaoGoodsBrief(commonGoods.getGoodsId()); |
| | | // goodsDetail = GoodsDetailVOFactory.convertTaoBao(goodsBrief, |
| | | // params); |
| | | // } catch (TaobaoGoodsDownException e) { |
| | | // JsonUtil.printMode(out, callback, |
| | | // JsonUtil.loadFalseResult("该商品已下架")); |
| | | // return; |
| | | // } |
| | | // } else if (commonGoods.getGoodsType() == Constant.SOURCE_TYPE_JD) |
| | | // { |
| | | // JDGoods goodsInfo = |
| | | // JDApiUtil.queryGoodsDetail(commonGoods.getGoodsId()); // 高级接口 |
| | | // if (goodsInfo == null) { |
| | | // goodsInfo = JDUtil.getGoodsDetail(commonGoods.getGoodsId()); // |
| | | // 爬取网页 |
| | | // //jdGoods = JDApiUtil.getGoodsDetail(goodsId); // 普通接口 |
| | | // } |
| | | //// JDGoods goodsInfo = |
| | | // jdGoodsCacheUtil.getGoodsInfo(commonGoods.getGoodsId()); |
| | | // goodsDetail = GoodsDetailVOFactory.convertJDGoods(goodsInfo, |
| | | // params); |
| | | // } else if (commonGoods.getGoodsType() == |
| | | // Constant.SOURCE_TYPE_PDD) { |
| | | // PDDGoodsDetail goodsInfo = |
| | | // pinDuoDuoCacheUtil.getGoodsInfo(commonGoods.getGoodsId()); |
| | | // goodsDetail = GoodsDetailVOFactory.convertPDDGoods(goodsInfo, |
| | | // params); |
| | | // } |
| | | |
| | | // if (goodsDetail == null) { |
| | | // JsonUtil.printMode(out, callback, |
| | | // JsonUtil.loadFalseResult("未找到该商品")); |
| | | // return; |
| | | // } |
| | | |
| | | List<String> imgList = new ArrayList<>(); |
| | | imgList.add( |
| | | "https://img.alicdn.com/bao/uploaded/i1/2578900982/O1CN01SUiNLE1J7nWMlpy1A_!!0-item_pic.jpg_220x220"); |
| | | imgList.add( |
| | | "https://img.alicdn.com/bao/uploaded/i1/2398662401/O1CN01I2UoTF1TbhXVwhJrz_!!0-item_pic.jpg_220x220"); |
| | | imgList.add( |
| | | "https://img.alicdn.com/bao/uploaded/i4/2640238597/O1CN01A5xBr32DNTYWJSDZe_!!0-item_pic.jpg_220x220"); |
| | | imgList.add( |
| | | "https://img.alicdn.com/bao/uploaded/i3/2640238597/O1CN01H5Q0Ni2DNTYxGAy3V_!!0-item_pic.jpg_220x220"); |
| | | |
| | | JSONObject object = new JSONObject(); |
| | | object.put("goodsId", 551062664275L); |
| | | object.put("goodsType", 1); |
| | | object.put("imgList", imgList); |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(object)); |
| | | } catch (Exception e) { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("获取失败")); |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 保存信息 |
| | | * |
| | | * @param callback |
| | | * @param special |
| | | * @param out |
| | | */ |
| | | @RequestMapping(value = "saveComment") |
| | | public void saveComment(String callback, String pid, CommentInfo commentInfo, PrintWriter out) { |
| | | try { |
| | | goodsEvaluateService.saveComment(pid, commentInfo); |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("保存成功")); |
| | | } catch (GoodsEvaluateException e) { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMsg())); |
| | | } catch (Exception e) { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("保存失败")); |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 删除信息 |
| | | * |
| | | * @param callback |
| | | * @param idArray |
| | | * @param out |
| | | */ |
| | | @RequestMapping(value = "deleteComment") |
| | | public void deleteComment(String callback, String pid, String idArray, PrintWriter out) { |
| | | try { |
| | | if (StringUtil.isNullOrEmpty(idArray)) { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("请选择操作的数据")); |
| | | return; |
| | | } |
| | | Gson gson = new Gson(); |
| | | List<String> list = gson.fromJson(idArray, new TypeToken<ArrayList<String>>() { |
| | | }.getType()); |
| | | |
| | | if (list == null || list.size() == 0) { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("未检测到删除的数据")); |
| | | return; |
| | | } |
| | | |
| | | goodsEvaluateService.deleteComment(pid, list); |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("删除成功")); |
| | | } catch (GoodsEvaluateException e) { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMsg())); |
| | | } catch (Exception e) { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("删除失败")); |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 查询品论 |
| | | * |
| | | * @param callback |
| | | * @param pageIndex |
| | | * @param pageSize |
| | | * @param bannerId |
| | | * @param out |
| | | */ |
| | | @RequestMapping(value = "queryComment") |
| | | public void queryComment(String callback, String pid, PrintWriter out) { |
| | | GoodsEvaluate goodsEvaluate = goodsEvaluateService.getById(pid); |
| | | if (goodsEvaluate == null) { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("该动态信息已不存在")); |
| | | return; |
| | | } |
| | | |
| | | List<CommentInfo> list = goodsEvaluate.getComments(); |
| | | if (list == null || list.size() == 0) { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("暂无数据")); |
| | | return; |
| | | } |
| | | |
| | | try { |
| | | long count = list.size(); |
| | | int totalPage = (int) (count % 100 == 0 ? count / 100 : count / 100 + 1); |
| | | PageEntity pe = new PageEntity(1, 100, count, totalPage); |
| | | |
| | | JSONObject data = new JSONObject(); |
| | | data.put("pe", pe); |
| | | data.put("result_list", list); |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data)); |
| | | } catch (Exception e) { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作异常")); |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | package com.yeshi.fanli.controller.admin;
|
| | |
|
| | | import java.io.PrintWriter;
|
| | | import java.util.ArrayList;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | |
|
| | |
| | |
|
| | | 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.bus.user.LostOrder;
|
| | | import com.yeshi.fanli.entity.bus.user.Order;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.service.inter.order.LostOrderService;
|
| | | import com.yeshi.fanli.tag.PageEntity;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | |
|
| | | import net.sf.json.JSONArray;
|
| | | import net.sf.json.JSONObject;
|
| | |
|
| | | @Controller
|
| | |
| | |
|
| | | }
|
| | |
|
| | | |
| | |
|
| | | /**
|
| | | * 统计提现申请总次数
|
| | | * @param callback
|
| | | * @param dateType 显示视图:日-1 、月-2、 年-3
|
| | | * @param state 状态: 1-未处理 2-成功 3-失败
|
| | | * @param year |
| | | * @param startTime
|
| | | * @param endTime
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getLostNum")
|
| | | public void getLostNum(String callback, Integer dateType, String stateArray, String year, |
| | | String startTime, String endTime, PrintWriter out) {
|
| | | 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;
|
| | | }
|
| | |
|
| | | List<Integer> channelList = null;
|
| | | if (stateArray != null && stateArray.trim().length() > 0) {
|
| | | Gson gson = new Gson();
|
| | | channelList = gson.fromJson(stateArray, new TypeToken<ArrayList<Integer>>() {}.getType());
|
| | | }
|
| | |
|
| | | |
| | | if (dateType == 1 && year != null) {
|
| | | year = null; // 设置为空
|
| | | } else if (dateType == 2) {
|
| | | if (startTime != null) |
| | | startTime = null; |
| | | |
| | | if (endTime != null) |
| | | endTime = null; |
| | | |
| | | } else if (dateType == 3) {
|
| | | if (year != null)
|
| | | year = null; |
| | | |
| | | if (startTime != null) |
| | | startTime = null; |
| | | |
| | | if (endTime != null) |
| | | endTime = null; |
| | | }
|
| | | |
| | | Gson gson = new Gson();
|
| | | Object objectDate = null;
|
| | | List<String> dateList = AdminUtils.getDateList(dateType, startTime, endTime, year);
|
| | | try {
|
| | | JSONArray line_list = new JSONArray();
|
| | | if (channelList == null || channelList.size() == 0) {
|
| | | |
| | | } else {
|
| | | for (Integer state : channelList) {
|
| | | List<ChartTDO> list = lostOrderService.countLostNum(dateType, state, year, |
| | | startTime, endTime);
|
| | | JSONObject innerList = new JSONObject();
|
| | | if (state == 1) {
|
| | | innerList.put("name", "未处理");
|
| | | } else if (state == 2) {
|
| | | innerList.put("name", "成功");
|
| | | } else if (state == 3) {
|
| | | innerList.put("name", "失败");
|
| | | }
|
| | |
|
| | | if (dateType != 3) {
|
| | | innerList.put("data", gson.toJson(AdminUtils.dayOrMonthDataFactory(dateType, dateList, list)));
|
| | | } else {
|
| | | // 年视图
|
| | | Map<String, Object> map = AdminUtils.yearsDataFactory(list);
|
| | | if (objectDate == null) {
|
| | | objectDate = map.get("date");
|
| | | }
|
| | | innerList.put("data", gson.toJson(map.get("value")));
|
| | | }
|
| | | |
| | | line_list.add(innerList);
|
| | | }
|
| | | }
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | if (objectDate != null) {
|
| | | data.put("xAxis_list", gson.toJson(objectDate));
|
| | | } else {
|
| | | 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 callback
|
| | | * @param dateType 显示视图:日-1 、月-2、 年-3
|
| | | * @param year |
| | | * @param startTime
|
| | | * @param endTime
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getAppealMoney")
|
| | | public void getAppealMoney(String callback, Integer dateType, String year, String startTime, String endTime,
|
| | | PrintWriter out) {
|
| | |
|
| | | 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 (dateType == 1 && year != null) {
|
| | | year = null; // 设置为空
|
| | | } else if (dateType == 2) {
|
| | | if (startTime != null) |
| | | startTime = null; |
| | | |
| | | if (endTime != null) |
| | | endTime = null; |
| | | |
| | | } else if (dateType == 3) {
|
| | | if (year != null)
|
| | | year = null; |
| | | |
| | | if (startTime != null) |
| | | startTime = null; |
| | | |
| | | if (endTime != null) |
| | | endTime = null; |
| | | }
|
| | | |
| | | Gson gson = new Gson();
|
| | | Object objectDate = null;
|
| | | List<String> dateList = AdminUtils.getDateList(dateType, startTime, endTime, year);
|
| | | try {
|
| | | JSONArray line_list = new JSONArray();
|
| | | List<ChartTDO> list = lostOrderService.countAppealMoney(dateType, year, startTime, endTime);
|
| | | JSONObject innerList = new JSONObject();
|
| | | innerList.put("name", "总计");
|
| | |
|
| | | if (dateType != 3) {
|
| | | innerList.put("data", gson.toJson(AdminUtils.dayOrMonthDataFactory(dateType, dateList, list)));
|
| | | } else {
|
| | | // 年视图
|
| | | Map<String, Object> map = AdminUtils.yearsDataFactory(list);
|
| | |
|
| | | if (objectDate == null) {
|
| | | objectDate = map.get("date");
|
| | | }
|
| | | innerList.put("data", gson.toJson(map.get("value")));
|
| | | }
|
| | | line_list.add(innerList);
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | if (objectDate != null) {
|
| | | data.put("xAxis_list", gson.toJson(objectDate));
|
| | | } else {
|
| | | 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 callback
|
| | | * @param channelArray
|
| | | * 名字数组
|
| | | * @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 = "get24HOderChannelCharts")
|
| | | public void get24HOderChannelCharts(String callback, String channelArray, Integer dateType, String year,
|
| | | String startTime, String endTime, PrintWriter out) {
|
| | |
|
| | | 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;
|
| | | }
|
| | |
|
| | | List<String> channelList = null;
|
| | | if (channelArray != null && channelArray.trim().length() > 0) {
|
| | | Gson gson = new Gson();
|
| | | channelList = gson.fromJson(channelArray, new TypeToken<ArrayList<String>>() {
|
| | | }.getType());
|
| | | }
|
| | |
|
| | | if (channelList == null || channelList.size() == 0) {
|
| | | channelList = new ArrayList<String>();
|
| | | channelList.add("all");
|
| | | }
|
| | |
|
| | | if (dateType == 1 && year != null) {
|
| | | year = null; // 设置为空
|
| | | } else if (dateType == 2) {
|
| | | if (startTime != null)
|
| | | startTime = null;
|
| | |
|
| | | if (endTime != null)
|
| | | endTime = null;
|
| | |
|
| | | } else if (dateType == 3) {
|
| | | if (year != null)
|
| | | year = null;
|
| | |
|
| | | if (startTime != null)
|
| | | startTime = null;
|
| | |
|
| | | if (endTime != null)
|
| | | endTime = null;
|
| | | }
|
| | |
|
| | | try {
|
| | |
|
| | | Gson gson = new Gson();
|
| | | Object objectDate = null;
|
| | | List<String> dateList = AdminUtils.getDateList(dateType, startTime, endTime, year);
|
| | |
|
| | | JSONArray line_list = new JSONArray();
|
| | |
|
| | | for (String channel : channelList) {
|
| | | List<ChartTDO> list = hongBaoV2CountService.count24HOderByChannel(channel, dateType, year, startTime,
|
| | | endTime);
|
| | |
|
| | | if ("all".equalsIgnoreCase(channel)) {
|
| | | channel = "总计";
|
| | | }
|
| | |
|
| | | JSONObject innerList = new JSONObject();
|
| | | innerList.put("name", channel);
|
| | |
|
| | | if (dateType != 3) {
|
| | | innerList.put("data", gson.toJson(AdminUtils.dayOrMonthDataFactory(dateType, dateList, list)));
|
| | | } else {
|
| | | // 年视图
|
| | | Map<String, Object> map = AdminUtils.yearsDataFactory(list);
|
| | |
|
| | | if (objectDate == null) {
|
| | | objectDate = map.get("date");
|
| | | }
|
| | | innerList.put("data", gson.toJson(map.get("value")));
|
| | | }
|
| | |
|
| | | line_list.add(innerList);
|
| | | }
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | if (objectDate != null) {
|
| | | data.put("xAxis_list", gson.toJson(objectDate));
|
| | | } else {
|
| | | 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 callback
|
| | | * @param channelArray
|
| | | * 渠道名 为空是统计所有
|
| | | * @param dateType
|
| | | * 显示视图:日-1 、月-2、 年-3
|
| | | * @param state
|
| | | * 状态: 1-未到账 2-已到账 3-已失效
|
| | | * @param year
|
| | | * @param startTime
|
| | | * @param endTime
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getHongBaoNum")
|
| | | public void getHongBaoNum(String callback, String channelArray, Integer dateType, Integer state, String year,
|
| | | String startTime, String endTime, PrintWriter out) {
|
| | |
|
| | | String validateMsg = AdminUtils.validateParams(dateType, startTime, endTime);
|
| | | if (validateMsg != null) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(validateMsg));
|
| | | return;
|
| | | }
|
| | |
|
| | | try {
|
| | | JSONObject data = countHistoryHongBao(channelArray, dateType, state, year, startTime, endTime, 1);
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
|
| | | } catch (Exception e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("系统异常"));
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /**
|
| | | * 统计提现申请总金额
|
| | | *
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | * 订单跟踪准确率(板栗快省用户订单/淘宝联盟订单)
|
| | | * |
| | | * @param callback
|
| | | * @param dateType
|
| | | * @param year
|
| | | * @param startTime
|
| | | * @param endTime
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getTrackAccuracyRate")
|
| | | public void getTrackAccuracyRate(String callback, Integer dateType, String year, String startTime, String endTime,
|
| | | int sourceType, PrintWriter out) {
|
| | |
|
| | | if (dateType != 1 && (!StringUtil.isNullOrEmpty(startTime) || !StringUtil.isNullOrEmpty(endTime))) {
|
| | | startTime = null;
|
| | | endTime = null;
|
| | | }
|
| | |
|
| | | if (dateType == 1 && year != null) {
|
| | | year = null; // 设置为空
|
| | | } else if (dateType == 2) {
|
| | | if (startTime != null)
|
| | | startTime = null;
|
| | |
|
| | | if (endTime != null)
|
| | | endTime = null;
|
| | |
|
| | | } else if (dateType == 3) {
|
| | | if (year != null)
|
| | | year = null;
|
| | |
|
| | | if (startTime != null)
|
| | | startTime = null;
|
| | |
|
| | | if (endTime != null)
|
| | | endTime = null;
|
| | | }
|
| | |
|
| | | try {
|
| | |
|
| | | Gson gson = new Gson();
|
| | | Object objectDate = null;
|
| | | List<String> dateList = AdminUtils.getDateList(dateType, startTime, endTime, year);
|
| | |
|
| | | JSONArray line_list = new JSONArray();
|
| | |
|
| | | List<ChartTDO> list = commonOrderCountService.getTrackAccuracyRate(dateType, year, startTime, endTime,
|
| | | sourceType);
|
| | |
|
| | | JSONObject innerList = new JSONObject();
|
| | | innerList.put("name", "总计");
|
| | |
|
| | | if (dateType != 3) {
|
| | | innerList.put("data", gson.toJson(AdminUtils.dayOrMonthDataFactory(dateType, dateList, list)));
|
| | | } else {
|
| | | // 年视图
|
| | | Map<String, Object> map = AdminUtils.yearsDataFactory(list);
|
| | |
|
| | | if (objectDate == null) {
|
| | | objectDate = map.get("date");
|
| | | }
|
| | | innerList.put("data", gson.toJson(map.get("value")));
|
| | | }
|
| | |
|
| | | line_list.add(innerList);
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | if (objectDate != null) {
|
| | | data.put("xAxis_list", gson.toJson(objectDate));
|
| | | } else {
|
| | | 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();
|
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | * 当前未收货订单数
|
| | |
| | | package com.yeshi.fanli.controller.admin;
|
| | |
|
| | | import java.io.PrintWriter;
|
| | | import java.net.URLDecoder;
|
| | | import java.text.SimpleDateFormat;
|
| | | import java.util.ArrayList;
|
| | | import java.util.Calendar;
|
| | |
| | | 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.BindingAccount;
|
| | | import com.yeshi.fanli.entity.bus.user.ForbiddenUserIdentifyCode;
|
| | | import com.yeshi.fanli.entity.bus.user.ForbiddenUserIdentifyCode.ForbiddenUserIdentifyCodeTypeEnum;
|
| | |
| | | @RequestMapping(value = "getNewUserCharts")
|
| | | public void getNewUserCharts(String callback, String channelArray, Integer dateType, String year, String startTime,
|
| | | String endTime, PrintWriter out) {
|
| | |
|
| | | 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;
|
| | | }
|
| | |
|
| | | List<String> channelList = null;
|
| | | if (channelArray != null && channelArray.trim().length() > 0) {
|
| | | Gson gson = new Gson();
|
| | | channelList = gson.fromJson(channelArray, new TypeToken<ArrayList<String>>() {
|
| | | }.getType());
|
| | | }
|
| | |
|
| | | if (channelList == null || channelList.size() == 0) {
|
| | | channelList = new ArrayList<String>();
|
| | | channelList.add("all");
|
| | | }
|
| | |
|
| | | if (dateType == 1 && year != null) {
|
| | | year = null; // 设置为空
|
| | | } else if (dateType == 2) {
|
| | | if (startTime != null)
|
| | | startTime = null;
|
| | |
|
| | | if (endTime != null)
|
| | | endTime = null;
|
| | |
|
| | | } else if (dateType == 3) {
|
| | | if (year != null)
|
| | | year = null;
|
| | |
|
| | | if (startTime != null)
|
| | | startTime = null;
|
| | |
|
| | | if (endTime != null)
|
| | | endTime = null;
|
| | | }
|
| | |
|
| | | 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;
|
| | | }
|
| | |
|
| | | 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();
|
| | | Object objectDate = null;
|
| | | List<String> dateList = AdminUtils.getDateList(dateType, startTime, endTime, year);
|
| | |
|
| | | |
| | | // 渠道
|
| | | List<String> channelList = null;
|
| | | if (channelArray != null && channelArray.trim().length() > 0) {
|
| | | channelList = gson.fromJson(channelArray, new TypeToken<ArrayList<String>>() {
|
| | | }.getType());
|
| | | }
|
| | | |
| | | JSONArray line_list = new JSONArray();
|
| | | for (String channel : channelList) {
|
| | |
|
| | | List<ChartTDO> list = userInfoCountService.countNewUserByDate(channel, dateType, year,
|
| | | startTime, endTime);
|
| | |
|
| | | if ("all".equalsIgnoreCase(channel)) {
|
| | | channel = "总计";
|
| | | |
| | | if (channelList != null && channelList.size() > 0) {
|
| | | for (String channel : channelList) {
|
| | | List<Object> list = getNewUserData(dateList, dateType, beginDate, endDate, channel);
|
| | | JSONObject innerList = new JSONObject();
|
| | | innerList.put("name", channel);
|
| | | innerList.put("data", gson.toJson(list));
|
| | | line_list.add(innerList);
|
| | | }
|
| | |
|
| | | } else {
|
| | | List<Object> list = getNewUserData(dateList, dateType, beginDate, endDate, null);
|
| | | JSONObject innerList = new JSONObject();
|
| | | innerList.put("name", channel);
|
| | |
|
| | | if (dateType != 3) {
|
| | | innerList.put("data", gson.toJson(AdminUtils.dayOrMonthDataFactory(dateType, dateList, list)));
|
| | | } else {
|
| | | // 年视图
|
| | | Map<String, Object> map = AdminUtils.yearsDataFactory(list);
|
| | |
|
| | | if (objectDate == null) {
|
| | | objectDate = map.get("date");
|
| | | }
|
| | | innerList.put("data", gson.toJson(map.get("value")));
|
| | | }
|
| | |
|
| | | innerList.put("name", "全部");
|
| | | innerList.put("data", gson.toJson(list));
|
| | | line_list.add(innerList);
|
| | | }
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | if (objectDate != null) {
|
| | | data.put("xAxis_list", gson.toJson(objectDate));
|
| | | } else {
|
| | | data.put("xAxis_list", gson.toJson(dateList));
|
| | | }
|
| | |
|
| | | 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("操作异常"));
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("系统异常"));
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | |
| | | |
| | | private List<Object> getNewUserData(List<String> dateList, Integer dateType, Date beginDate, Date endDate, String channel) {
|
| | | List<Object> list = new ArrayList<>();
|
| | | List<CountUserInfo> listHistory = userInfoCountService.getNewUserData(beginDate, endDate, channel);
|
| | | 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;
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | }
|
| | | } 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;
|
| | |
| | |
|
| | | import java.io.PrintWriter;
|
| | | import java.lang.reflect.Type;
|
| | | import java.math.BigDecimal;
|
| | | import java.util.ArrayList;
|
| | | import java.util.Calendar;
|
| | | import java.util.Date;
|
| | |
| | | import org.springframework.stereotype.Controller;
|
| | | import org.springframework.web.bind.annotation.RequestMapping;
|
| | | import org.springframework.web.bind.annotation.RequestMethod;
|
| | | import org.yeshi.utils.HttpUtil;
|
| | | import org.yeshi.utils.JsonUtil;
|
| | | import org.yeshi.utils.entity.FileUploadResult;
|
| | |
|
| | | import com.google.gson.Gson;
|
| | | import com.google.gson.GsonBuilder;
|
| | |
| | | import com.google.gson.JsonPrimitive;
|
| | | import com.google.gson.JsonSerializationContext;
|
| | | import com.google.gson.JsonSerializer;
|
| | | import com.yeshi.fanli.dto.jd.JDCouponInfo;
|
| | | import com.yeshi.fanli.entity.accept.AcceptData;
|
| | | import com.yeshi.fanli.entity.bus.activity.ActivityUser;
|
| | | import com.yeshi.fanli.entity.bus.clazz.GoodsClass;
|
| | | import com.yeshi.fanli.entity.bus.homemodule.Special;
|
| | | import com.yeshi.fanli.entity.bus.homemodule.SpecialLabel;
|
| | | import com.yeshi.fanli.entity.bus.homemodule.SwiperPicture;
|
| | | import com.yeshi.fanli.entity.bus.user.UserExtraTaoBaoInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.entity.common.JumpDetailV2;
|
| | | import com.yeshi.fanli.entity.dynamic.CommentInfo;
|
| | | import com.yeshi.fanli.entity.dynamic.CommentInfo.CommentInfoEnum;
|
| | | import com.yeshi.fanli.entity.dynamic.DynamicInfo;
|
| | | import com.yeshi.fanli.entity.dynamic.GoodsEvaluate;
|
| | | import com.yeshi.fanli.entity.dynamic.GoodsPicture;
|
| | | import com.yeshi.fanli.entity.dynamic.ImgInfo;
|
| | | import com.yeshi.fanli.entity.dynamic.ImgInfo.ImgEnum;
|
| | | import com.yeshi.fanli.entity.dynamic.SimpleGoods;
|
| | | import com.yeshi.fanli.entity.jd.JDGoods;
|
| | | import com.yeshi.fanli.entity.system.ConfigKeyEnum;
|
| | | import com.yeshi.fanli.service.inter.common.JumpDetailV2Service;
|
| | | import com.yeshi.fanli.service.inter.config.ConfigService;
|
| | | import com.yeshi.fanli.service.inter.dynamic.ArticleOfficialService;
|
| | | import com.yeshi.fanli.service.inter.dynamic.DynamicInfoService;
|
| | | import com.yeshi.fanli.service.inter.dynamic.GoodsEvaluateService;
|
| | | import com.yeshi.fanli.service.inter.goods.TaoBaoGoodsBriefService;
|
| | | import com.yeshi.fanli.service.inter.homemodule.SpecialService;
|
| | | import com.yeshi.fanli.service.inter.homemodule.SwiperPictureService;
|
| | | import com.yeshi.fanli.service.inter.order.config.HongBaoManageService;
|
| | | import com.yeshi.fanli.service.inter.user.QrCodeService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoService;
|
| | | import com.yeshi.fanli.service.inter.user.tb.UserExtraTaoBaoInfoService;
|
| | | import com.yeshi.fanli.util.AESUtil;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.VersionUtil;
|
| | | import com.yeshi.fanli.util.cache.JDGoodsCacheUtil;
|
| | | import com.yeshi.fanli.util.jd.JDApiUtil;
|
| | | import com.yeshi.fanli.util.jd.JDUtil;
|
| | | import com.yeshi.fanli.util.pinduoduo.PinDuoDuoApiUtil;
|
| | | import com.yeshi.fanli.util.taobao.DaTaoKeUtil;
|
| | | import com.yeshi.fanli.vo.dynamic.ArticleVO;
|
| | | import com.yeshi.fanli.vo.goods.GoodsDetailVO;
|
| | | import com.yeshi.fanli.vo.msg.ClientTextStyleVO;
|
| | |
|
| | | import net.sf.json.JSONObject;
|
| | |
| | |
|
| | | @Resource
|
| | | private ArticleOfficialService articleOfficialService;
|
| | | |
| | |
|
| | | @Resource
|
| | | private SwiperPictureService swiperPictureService;
|
| | |
|
| | | @Resource
|
| | | private ConfigService configService;
|
| | | |
| | |
|
| | | @Resource
|
| | | private GoodsEvaluateService goodsEvaluateService;
|
| | |
|
| | | @Resource
|
| | | private UserInfoService userInfoService;
|
| | |
|
| | | @Resource
|
| | | private UserExtraTaoBaoInfoService userExtraTaoBaoInfoService;
|
| | |
|
| | | @Resource
|
| | | private JDGoodsCacheUtil jdGoodsCacheUtil;
|
| | |
|
| | | @Resource
|
| | | private QrCodeService qrCodeService;
|
| | |
|
| | | /**
|
| | | * 查询顶部分类
|
| | |
| | |
|
| | | // 2.0.6版本增加 学院栏目
|
| | | if (VersionUtil.greaterThan_2_0_6(acceptData.getPlatform(), acceptData.getVersion())) {
|
| | | //list.add(menu6);
|
| | | // list.add(menu6);
|
| | | }
|
| | | list.add(menu4);
|
| | |
|
| | |
| | | data.put("list", JsonUtil.getApiCommonGson().toJson(list));
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | | |
| | |
|
| | | /**
|
| | | * 动态商品列表
|
| | | *
|
| | |
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | |
|
| | |
|
| | | |
| | | |
| | | /**
|
| | | * 时间处理
|
| | | *
|
| | |
| | | Gson gson = gb.create();
|
| | | return gson;
|
| | | }
|
| | | |
| | |
|
| | | /**
|
| | | * 活动列表
|
| | | *
|
| | |
| | | * @param out
|
| | | */
|
| | | private void getArticleList(AcceptData acceptData, Integer page, String key, boolean search, PrintWriter out) {
|
| | | List<ArticleVO> list = articleOfficialService.queryValid((page - 1) * Constant.PAGE_SIZE, Constant.PAGE_SIZE, key);
|
| | | List<ArticleVO> list = articleOfficialService.queryValid((page - 1) * Constant.PAGE_SIZE, Constant.PAGE_SIZE,
|
| | | key);
|
| | | if (list != null) {
|
| | | for (ArticleVO article: list) {
|
| | | for (ArticleVO article : list) {
|
| | | String tags = article.getTags();
|
| | | if (StringUtil.isNullOrEmpty(tags)) {
|
| | | continue;
|
| | | }
|
| | | |
| | |
|
| | | String[] arrayTags = tags.split("\\s+");
|
| | | if (arrayTags == null || arrayTags.length == 0) {
|
| | | continue;
|
| | | }
|
| | | |
| | |
|
| | | String[] arrayTagsColour = null;
|
| | | String tagsColour = article.getTagsColour();
|
| | | if (!StringUtil.isNullOrEmpty(tagsColour)) {
|
| | | arrayTagsColour = tagsColour.split("\\s+");
|
| | | }
|
| | | |
| | |
|
| | | String color = "#FE0014";
|
| | | List<ClientTextStyleVO> labels = new ArrayList<ClientTextStyleVO>();
|
| | | for (int i = 0; i < arrayTags.length;i ++) {
|
| | | for (int i = 0; i < arrayTags.length; i++) {
|
| | | String tag = arrayTags[i];
|
| | | if (arrayTagsColour != null && arrayTagsColour.length == arrayTags.length) {
|
| | | color = arrayTagsColour[i];
|
| | |
| | | article.setLabels(labels);
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | GsonBuilder gsonBuilder = new GsonBuilder().excludeFieldsWithoutExposeAnnotation();
|
| | | Gson gson = gsonBuilder.create();
|
| | | |
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | if (page == 1 && !search) {
|
| | | List<SwiperPicture> banners = swiperPictureService.getByBannerCardAndVersion("article_banners",acceptData.getPlatform(), Integer.parseInt(acceptData.getVersion()));
|
| | | List<SwiperPicture> banners = swiperPictureService.getByBannerCardAndVersion("article_banners",
|
| | | acceptData.getPlatform(), Integer.parseInt(acceptData.getVersion()));
|
| | | if (banners == null)
|
| | | banners = new ArrayList<>();
|
| | | data.put("banners", gson.toJson(banners));
|
| | | |
| | |
|
| | | List<Special> listSpecial = specialService.listByVersion(0, Integer.MAX_VALUE, "article_specials",
|
| | | acceptData.getPlatform(), Integer.parseInt(acceptData.getVersion()));
|
| | | if (listSpecial == null)
|
| | | listSpecial = new ArrayList<>();
|
| | | |
| | |
|
| | | for (Special special : listSpecial) {
|
| | | boolean needLogin = special.isJumpLogin();
|
| | | JumpDetailV2 jumpDetail = special.getJumpDetail();
|
| | |
| | | data.put("list", gson.toJson(list));
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | | |
| | |
|
| | | /**
|
| | | * 文章搜索
|
| | | * |
| | | * @param acceptData
|
| | | * @param page
|
| | | * @param key
|
| | |
| | | */
|
| | | @RequestMapping(value = "readArticle", method = RequestMethod.POST)
|
| | | public void readArticle(AcceptData acceptData, String id, PrintWriter out) {
|
| | | if(StringUtil.isNullOrEmpty(id)) {
|
| | | if (StringUtil.isNullOrEmpty(id)) {
|
| | | out.print(JsonUtil.loadFalseResult("id不能为空"));
|
| | | return;
|
| | | }
|
| | | articleOfficialService.updateReadNum(id);
|
| | | out.print(JsonUtil.loadTrueResult("操作成功"));
|
| | | }
|
| | | |
| | | |
| | |
|
| | | /**
|
| | | * 文章搜索
|
| | | * |
| | | * @param acceptData
|
| | | * @param page
|
| | | * @param key
|
| | |
| | | public void searchArticle(AcceptData acceptData, Integer page, String key, PrintWriter out) {
|
| | | getArticleList(acceptData, page, key, true, out);
|
| | | }
|
| | | |
| | | |
| | |
|
| | | /**
|
| | | * 文章搜索
|
| | | * |
| | | * @param acceptData
|
| | | * @param page
|
| | | * @param key
|
| | |
| | | out.print(configService.get("test"));
|
| | | }
|
| | |
|
| | | /**
|
| | | * 发圈列表
|
| | | * |
| | | * @param acceptData
|
| | | * @param page
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "evaluate", method = RequestMethod.POST)
|
| | | public void evaluate(AcceptData acceptData, Integer page, PrintWriter out) {
|
| | | long cid = 1;
|
| | | long subId = 1;
|
| | | List<DynamicInfo> listd = dynamicInfoService.queryV2(2, 74, (page - 1) * Constant.PAGE_SIZE, Constant.PAGE_SIZE,
|
| | | cid, subId);
|
| | | if (listd == null) {
|
| | | listd = new ArrayList<DynamicInfo>();
|
| | | }
|
| | |
|
| | | List<GoodsEvaluate> list = new ArrayList<>();
|
| | |
|
| | | for (DynamicInfo info : listd) {
|
| | | GoodsEvaluate goodsEvaluate = new GoodsEvaluate();
|
| | | goodsEvaluate.setId(info.getId());
|
| | | ActivityUser user = info.getUser();
|
| | | user.setTag("烧烤达人");
|
| | | goodsEvaluate.setUser(user);
|
| | | goodsEvaluate.setTitle(info.getTitle().get(0).getContent());
|
| | | goodsEvaluate.setShareNum(info.getShareCount());
|
| | | goodsEvaluate.setPublishTime(info.getCreateTime());
|
| | | goodsEvaluate.setLineNum(2);
|
| | | List<GoodsPicture> imgs = info.getImgs();
|
| | |
|
| | | List<ImgInfo> imgList = new ArrayList<>();
|
| | | int i = 0;
|
| | | for (GoodsPicture goodsPicture : imgs) {
|
| | | ImgInfo imgInfo = new ImgInfo();
|
| | | GoodsDetailVO goodsVO = goodsPicture.getGoodsVO();
|
| | | imgInfo.setH(100);
|
| | | imgInfo.setW(100);
|
| | | if (goodsVO != null) {
|
| | | imgInfo.setType(ImgEnum.goods);
|
| | |
|
| | | SimpleGoods simpleGoods = new SimpleGoods();
|
| | | simpleGoods.setPrice(goodsVO.getZkPrice());
|
| | | simpleGoods.setAmount(new BigDecimal(115));
|
| | | simpleGoods.setGoodsId(goodsVO.getGoodsId());
|
| | | simpleGoods.setGoodsType(1);
|
| | | simpleGoods.setState(1);
|
| | | imgInfo.setGoods(simpleGoods);
|
| | |
|
| | | goodsEvaluate.setGoods(goodsVO);
|
| | | } else {
|
| | | imgInfo.setType(ImgEnum.img);
|
| | | }
|
| | |
|
| | | imgInfo.setLarge(false);
|
| | | imgInfo.setUrl(goodsPicture.getUrl());
|
| | | imgInfo.setUrlHD(goodsPicture.getUrl());
|
| | |
|
| | | // if (i == 0) {
|
| | | // imgInfo.setUrl(goodsPicture.getUrl());
|
| | | // imgInfo.setType(ImgEnum.video);
|
| | | // imgInfo.setLarge(true);
|
| | | // imgInfo.setVideoUrl(
|
| | | // "http://pgcvideo.cdn.xiaodutv.com/754825344_367171606_2020010816001720200108174342.mp4?Cache-Control=max-age%3D8640000&responseExpires=Fri%2C+17+Apr+2020+18%3A11%3A55+GMT&xcode=0b0f3962eddaf66837d4af61a22c57bae3a5055540c75232&time=1579077845&_=1578992502888");
|
| | | // } else {
|
| | | // imgInfo.setType(ImgEnum.img);
|
| | | // imgInfo.setLarge(true);
|
| | | // imgInfo.setUrl(goodsPicture.getUrl());
|
| | | // }
|
| | | // i++;
|
| | |
|
| | | imgList.add(imgInfo);
|
| | | }
|
| | |
|
| | | goodsEvaluate.setImgList(imgList);
|
| | |
|
| | | CommentInfo commentInfo = new CommentInfo();
|
| | | commentInfo.setId(info.getId() + "09");
|
| | | commentInfo.setContent("😆7.9元🉐1只儿童牙刷!!安妮贝拉卡通版儿童牙⭕PBT材质,毛刷细腻柔⭕外观卡通人物造型设计");
|
| | | commentInfo.setType(CommentInfoEnum.goodsCoupon);
|
| | |
|
| | | // ClientTextStyleVO text1 = new ClientTextStyleVO();
|
| | | // text1.setContent("猫超");
|
| | | // text1.setColor("#1D9B31");
|
| | | // |
| | | // ClientTextStyleVO text2 = new ClientTextStyleVO();
|
| | | // text2.setContent("满150减15");
|
| | | // text2.setColor("#E5005C");
|
| | | // List<ClientTextStyleVO> tagList = new ArrayList<>(); |
| | | // tagList.add(text1);
|
| | | // tagList.add(text2);
|
| | | // commentInfo.setTagList(tagList);
|
| | | // commentInfo.setTagDesc("除生鲜及部分酒水除生鲜及除生鲜及");
|
| | |
|
| | | CommentInfo commentInfo2 = new CommentInfo();
|
| | | commentInfo2.setContent("😆7.9元🉐1只儿童牙刷!!安妮贝拉卡通版儿童牙⭕PBT材质,毛刷细腻柔⭕外观卡通人物造型设计");
|
| | | commentInfo2.setType(CommentInfoEnum.goodsCoupon);
|
| | |
|
| | | ClientTextStyleVO text1 = new ClientTextStyleVO();
|
| | | text1.setContent("猫超");
|
| | | text1.setColor("#1D9B31");
|
| | |
|
| | | ClientTextStyleVO text2 = new ClientTextStyleVO();
|
| | | text2.setContent("满150减15");
|
| | | text2.setColor("#E5005C");
|
| | | List<ClientTextStyleVO> tagList = new ArrayList<>();
|
| | | tagList.add(text1);
|
| | | tagList.add(text2);
|
| | | commentInfo2.setTagList(tagList);
|
| | | commentInfo2.setTagDesc("除生鲜及部分酒水除生鲜及除生鲜及");
|
| | | commentInfo.setTagUrl("http://www.baidu.com");
|
| | |
|
| | | List<CommentInfo> commentList = new ArrayList<>();
|
| | | commentList.add(commentInfo);
|
| | | commentList.add(commentInfo2);
|
| | |
|
| | | goodsEvaluate.setComments(commentList);
|
| | | list.add(goodsEvaluate);
|
| | | }
|
| | |
|
| | | // List<GoodsEvaluate> list = goodsEvaluateService.queryValidEvaluateCache((page - 1) * Constant.PAGE_SIZE, Constant.PAGE_SIZE);
|
| | | // if (list == null) {
|
| | | // list = new ArrayList<>();
|
| | | // }
|
| | |
|
| | | GsonBuilder gsonBuilder = new GsonBuilder().excludeFieldsWithoutExposeAnnotation();
|
| | | gsonBuilder.registerTypeAdapter(CommentInfoEnum.class, new JsonSerializer<CommentInfoEnum>() {
|
| | | @Override
|
| | | public JsonElement serialize(CommentInfoEnum value, Type theType, JsonSerializationContext context) {
|
| | | if (value == null) {
|
| | | return new JsonPrimitive(1);
|
| | | } else {
|
| | | return new JsonPrimitive(value.getDesc());
|
| | | }
|
| | | }
|
| | | }).registerTypeAdapter(ImgEnum.class, new JsonSerializer<ImgEnum>() {
|
| | | @Override
|
| | | public JsonElement serialize(ImgEnum value, Type theType, JsonSerializationContext context) {
|
| | | if (value == null) {
|
| | | return new JsonPrimitive("");
|
| | | } else {
|
| | | return new JsonPrimitive(value.getVlaue());
|
| | | }
|
| | | }
|
| | | }).registerTypeAdapter(Date.class, new JsonSerializer<Date>() {
|
| | | @Override
|
| | | public JsonElement serialize(Date value, Type theType, JsonSerializationContext context) {
|
| | | String desc = "";
|
| | | if (value != null) {
|
| | | // 判断是否是同一天
|
| | |
|
| | | Calendar calendar = Calendar.getInstance();
|
| | | calendar.setTime(value);
|
| | | int y1 = calendar.get(Calendar.YEAR);// 获取年份
|
| | | int d1 = calendar.get(Calendar.DAY_OF_YEAR);// 获取年中第几天
|
| | |
|
| | | Date nowDate = new Date();
|
| | | Calendar calendar2 = Calendar.getInstance();
|
| | | calendar2.setTime(nowDate);
|
| | | int y2 = calendar2.get(Calendar.YEAR);// 获取年份
|
| | | int d2 = calendar2.get(Calendar.DAY_OF_YEAR);// 获取年中第几天
|
| | |
|
| | | long old = value.getTime();
|
| | | long now = nowDate.getTime();
|
| | | if (y1 == y2) {
|
| | | if (d1 == d2) {
|
| | | long cha = now - old;
|
| | | if (cha < 1000 * 60 * 2L) {
|
| | | desc = "刚刚";
|
| | | } else if (cha < 1000 * 60 * 60L) {
|
| | | desc = (cha / (1000 * 60)) + "分钟前";
|
| | | } else {
|
| | | desc = (cha / (1000 * 60 * 60)) + "小时前";
|
| | | }
|
| | | } else if (d2 - d1 == 1) {
|
| | | desc = "昨天";
|
| | | } else {
|
| | | desc = (d2 - d1) + "天前";
|
| | | }
|
| | | } else {
|
| | | int timeDistance = 0;
|
| | | for (int i = y1; i < y2; i++) {
|
| | | if (i % 4 == 0 && i % 100 != 0 || i % 400 == 0) {
|
| | | timeDistance += 366; // 闰年
|
| | | } else {
|
| | | timeDistance += 365; // 不是闰年
|
| | | }
|
| | | }
|
| | | desc = timeDistance + (d2 - d1) + "天前";
|
| | | }
|
| | |
|
| | | return new JsonPrimitive(desc);
|
| | | }
|
| | |
|
| | | return new JsonPrimitive("");
|
| | | }
|
| | | });
|
| | | Gson gson = gsonBuilder.create();
|
| | | long count = dynamicInfoService.count(cid, subId); // goodsEvaluateService.countValid()
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("count", count);
|
| | | data.put("list", gson.toJson(list));
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | |
|
| | | @RequestMapping(value = "evaluateShare", method = RequestMethod.POST)
|
| | | public void evaluateShare(AcceptData acceptData, Long uid, String id, Integer type, Long goodsId, Integer goodsType, PrintWriter out) {
|
| | | if (uid == null) {
|
| | | out.print(JsonUtil.loadFalseResult("用户未登录"));
|
| | | return;
|
| | | }
|
| | | |
| | | if (StringUtil.isNullOrEmpty(id) || type == null) {
|
| | | out.print(JsonUtil.loadFalseResult("传递参数不能为空"));
|
| | | return;
|
| | | }
|
| | | |
| | | if (type == 1 && (goodsId == null || goodsType == null)) {
|
| | | out.print(JsonUtil.loadFalseResult("商品参数不能为空"));
|
| | | return;
|
| | | }
|
| | |
|
| | | DynamicInfo dynamicInfo = dynamicInfoService.getById(id);
|
| | | if (dynamicInfo == null) {
|
| | | out.print(JsonUtil.loadFalseResult("该内容已不存在"));
|
| | | return;
|
| | | }
|
| | |
|
| | | UserInfo user = userInfoService.getUserByIdWithMybatis(uid);
|
| | | if (user == null) {
|
| | | out.print(JsonUtil.loadFalseResult("用户未登录"));
|
| | | return;
|
| | | }
|
| | |
|
| | | if (user != null && user.getState() != UserInfo.STATE_NORMAL) {
|
| | | out.print(JsonUtil.loadFalseResult(Constant.CODE_FORBIDDEN_USER, Constant.FORBIDDEN_USER_REASON_DESC));
|
| | | return;
|
| | | }
|
| | |
|
| | | UserExtraTaoBaoInfo taoBaoInfo = userExtraTaoBaoInfoService.getByUid(uid);
|
| | | String relationId = null;
|
| | | if (taoBaoInfo != null && taoBaoInfo.getRelationId() != null && taoBaoInfo.getRelationValid() != null
|
| | | && taoBaoInfo.getRelationValid() == true)
|
| | | relationId = taoBaoInfo.getRelationId();
|
| | |
|
| | | if (StringUtil.isNullOrEmpty(relationId)) {
|
| | | out.print(JsonUtil.loadFalseResult(2, "淘宝未授权,请前往\"我的\"绑定淘宝账号"));
|
| | | return;
|
| | | }
|
| | |
|
| | | List<GoodsPicture> imgs = dynamicInfo.getImgs();
|
| | | if (imgs == null) {
|
| | | out.print(JsonUtil.loadFalseResult("该图片内容已不存在"));
|
| | | return;
|
| | | }
|
| | | |
| | | int total = 0;
|
| | | for (GoodsPicture goodsPicture : imgs) {
|
| | | GoodsDetailVO goodsVO = goodsPicture.getGoodsVO();
|
| | | if (goodsVO != null) {
|
| | | total ++;
|
| | | }
|
| | | }
|
| | |
|
| | | List<String> list = new ArrayList<>();
|
| | | for (GoodsPicture goodsPicture : imgs) {
|
| | | GoodsDetailVO goodsVO = goodsPicture.getGoodsVO();
|
| | | if (goodsVO == null && total <= 1) {
|
| | | list.add(goodsPicture.getUrl());
|
| | | continue;
|
| | | }
|
| | | |
| | | if (type == 1) {
|
| | | if (goodsVO.getGoodsId().longValue() == goodsId.longValue() && goodsVO.getGoodsType() == goodsType.intValue()) {
|
| | | String jumpLink = getJumpLink(goodsVO, user);
|
| | | if (!StringUtil.isNullOrEmpty(jumpLink)) {
|
| | | list.add(jumpLink);
|
| | | }
|
| | | }
|
| | | } else {
|
| | | String jumpLink = getJumpLink(goodsVO, user);
|
| | | if (!StringUtil.isNullOrEmpty(jumpLink)) {
|
| | | list.add(jumpLink);
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | Integer shareCount = dynamicInfo.getShareCount();
|
| | | if (shareCount == null) {
|
| | | shareCount = 0;
|
| | | }
|
| | |
|
| | | if (type == 3) {
|
| | | shareCount++;
|
| | | dynamicInfoService.updateShareCount(dynamicInfo);
|
| | | }
|
| | |
|
| | | if (list.size() == 0) {
|
| | | out.print(JsonUtil.loadFalseResult("该信息已下架"));
|
| | | return;
|
| | | }
|
| | | |
| | | JSONObject data = new JSONObject();
|
| | | data.put("count", shareCount);
|
| | | data.put("list", list);
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | |
|
| | | private String getJumpLink(GoodsDetailVO goodsVO, UserInfo user) {
|
| | | String jumpLink = null;
|
| | | if (goodsVO.getGoodsType() == Constant.SOURCE_TYPE_TAOBAO) {
|
| | | String url = String.format("http://%s%s?uid=%s&id=%s&appType=flq", configService.getH5Host(),
|
| | | Constant.systemCommonConfig.getShareGoodsPagePath(),
|
| | | AESUtil.encrypt(user.getId() + "", Constant.UIDAESKEY), goodsVO.getGoodsId() + "");
|
| | | String shortLink = HttpUtil.getShortLink(url);
|
| | | if (!StringUtil.isNullOrEmpty(shortLink)) {
|
| | | url = shortLink;
|
| | | }
|
| | | } else if (goodsVO.getGoodsType() == Constant.SOURCE_TYPE_JD) {
|
| | | JDGoods jdGoods = jdGoodsCacheUtil.getGoodsInfo(goodsVO.getGoodsId());
|
| | | if (jdGoods == null ) {
|
| | | return null;
|
| | | }
|
| | | |
| | | String couponUrl = null;
|
| | | JDCouponInfo couponInfo = JDUtil.getShowCouponInfo(jdGoods);
|
| | | if (couponInfo != null) {
|
| | | couponUrl = couponInfo.getLink();
|
| | | }
|
| | | String materialId = "https://item.jd.com/" + goodsVO.getGoodsId() + ".html";
|
| | | jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, couponUrl, JDApiUtil.POSITION_SHARE + "",
|
| | | user.getId() + "");
|
| | | } else if (goodsVO.getGoodsType() == Constant.SOURCE_TYPE_PDD) {
|
| | | jumpLink = PinDuoDuoApiUtil.getPromotionUrl(goodsVO.getGoodsId(), PinDuoDuoApiUtil.PID_SHARE + "", user.getId() + "");
|
| | | }
|
| | | FileUploadResult uploadResult = qrCodeService.drawGoodsPoster(jumpLink, user.getPortrait(), goodsVO);
|
| | | if (uploadResult != null) {
|
| | | return uploadResult.getUrl();
|
| | | }
|
| | | return null;
|
| | | }
|
| | | |
| | | |
| | | /**
|
| | | * 评论复制
|
| | | * @param acceptData
|
| | | * @param id
|
| | | * @param cid 评论id
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "evaluateComment", method = RequestMethod.POST)
|
| | | public void evaluateComment(AcceptData acceptData, Long uid, String id, String cid, PrintWriter out) {
|
| | | if (StringUtil.isNullOrEmpty(id)) {
|
| | | out.print(JsonUtil.loadFalseResult("id不能为空"));
|
| | | return;
|
| | | }
|
| | | |
| | | DynamicInfo dynamicInfo = dynamicInfoService.getById(id);
|
| | | if (dynamicInfo == null) {
|
| | | out.print(JsonUtil.loadFalseResult("该内容已不存在"));
|
| | | return;
|
| | | }
|
| | |
|
| | | UserInfo user = userInfoService.getUserByIdWithMybatis(uid);
|
| | | if (user == null) {
|
| | | out.print(JsonUtil.loadFalseResult("用户未登录"));
|
| | | return;
|
| | | }
|
| | |
|
| | | if (user != null && user.getState() != UserInfo.STATE_NORMAL) {
|
| | | out.print(JsonUtil.loadFalseResult(Constant.CODE_FORBIDDEN_USER, Constant.FORBIDDEN_USER_REASON_DESC));
|
| | | return;
|
| | | }
|
| | | |
| | | UserExtraTaoBaoInfo taoBaoInfo = userExtraTaoBaoInfoService.getByUid(uid);
|
| | | String relationId = null;
|
| | | if (taoBaoInfo != null && taoBaoInfo.getRelationId() != null && taoBaoInfo.getRelationValid() != null
|
| | | && taoBaoInfo.getRelationValid() == true)
|
| | | relationId = taoBaoInfo.getRelationId();
|
| | |
|
| | | if (StringUtil.isNullOrEmpty(relationId)) {
|
| | | out.print(JsonUtil.loadFalseResult(2, "淘宝未授权,请前往\"我的\"绑定淘宝账号"));
|
| | | return;
|
| | | }
|
| | | |
| | | JSONObject data = new JSONObject();
|
| | | data.put("text", "安妮贝拉卡通版儿拉卡通版拉卡通版拉卡通版拉卡通版拉卡通版拉卡通版拉卡通版");
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.dao.dynamic; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.regex.Pattern; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | import com.yeshi.fanli.entity.dynamic.GoodsEvaluate; |
| | | import com.yeshi.fanli.util.StringUtil; |
| | | |
| | | @Repository |
| | | public class GoodsEvaluateDao { |
| | | |
| | | @Resource |
| | | private MongoTemplate mongoTemplate; |
| | | |
| | | /** |
| | | * 新增 |
| | | * |
| | | * @param record |
| | | */ |
| | | public void save(GoodsEvaluate record) { |
| | | if (record == null) { |
| | | return; |
| | | } |
| | | mongoTemplate.save(record); |
| | | } |
| | | |
| | | /** |
| | | * 根据id查询数据 |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | | public GoodsEvaluate getById(String id) { |
| | | Query query = new Query(); |
| | | query.addCriteria(Criteria.where("id").is(id)); |
| | | return mongoTemplate.findOne(query, GoodsEvaluate.class); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 删除 |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | | public void deleteById(String id) { |
| | | GoodsEvaluate info = getById(id); |
| | | if (info == null) { |
| | | return; |
| | | } |
| | | mongoTemplate.remove(info); |
| | | } |
| | | |
| | | /** |
| | | * 查询 |
| | | * |
| | | * @return |
| | | */ |
| | | public List<GoodsEvaluate> query(int start, int count, String key, Integer state) { |
| | | Query query = new Query(); |
| | | if (state != null) { |
| | | query.addCriteria(Criteria.where("state").is(state)); |
| | | } |
| | | if (!StringUtil.isNullOrEmpty(key)) |
| | | query.addCriteria(new Criteria().orOperator( |
| | | Criteria.where("title").regex(Pattern.compile("^.*" + key + ".*$", Pattern.CASE_INSENSITIVE)))); |
| | | |
| | | query.skip(start).limit(count); |
| | | query.with(new Sort(Sort.Direction.DESC,"weight")).with(new Sort(Sort.Direction.DESC,"createTime")); |
| | | return mongoTemplate.find(query, GoodsEvaluate.class); |
| | | } |
| | | |
| | | public long count(String key, Integer state) { |
| | | Query query = new Query(); |
| | | if (state != null) { |
| | | query.addCriteria(Criteria.where("state").is(state)); |
| | | } |
| | | if (!StringUtil.isNullOrEmpty(key)) |
| | | query.addCriteria(new Criteria().orOperator( |
| | | Criteria.where("title").regex(Pattern.compile("^.*" + key + ".*$", Pattern.CASE_INSENSITIVE)))); |
| | | return mongoTemplate.count(query, GoodsEvaluate.class); |
| | | } |
| | | |
| | | /** |
| | | * 查询有效 |
| | | * @param start |
| | | * @param count |
| | | * @param key |
| | | * @return |
| | | */ |
| | | public List<GoodsEvaluate> queryValid(int start, int count) { |
| | | Date now = new Date(); |
| | | Query query = new Query(); |
| | | query.addCriteria(Criteria.where("state").is(1)); |
| | | query.addCriteria(Criteria.where("startTime").lte(now)); |
| | | query.addCriteria(Criteria.where("endTime").gte(now)); |
| | | query.skip(start).limit(count); |
| | | query.with(new Sort(Sort.Direction.DESC,"weight")).with(new Sort(Sort.Direction.DESC,"createTime")); |
| | | return mongoTemplate.find(query, GoodsEvaluate.class); |
| | | } |
| | | |
| | | /** |
| | | * 统计有效 |
| | | * @param key |
| | | * @return |
| | | */ |
| | | public long countValid() { |
| | | Date now = new Date(); |
| | | Query query = new Query(); |
| | | query.addCriteria(Criteria.where("state").is(1)); |
| | | query.addCriteria(Criteria.where("startTime").lte(now)); |
| | | query.addCriteria(Criteria.where("endTime").gte(now)); |
| | | return mongoTemplate.count(query, GoodsEvaluate.class); |
| | | } |
| | | |
| | | } |
| | |
| | | package com.yeshi.fanli.dao.mybatis;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.List;
|
| | |
|
| | | import org.apache.ibatis.annotations.Param;
|
| | |
| | | /**
|
| | | * 统计审核次数
|
| | | * @param state
|
| | | * @param type
|
| | | * @param years
|
| | | * @param startTime
|
| | | * @param endTime
|
| | | * @return
|
| | | */
|
| | | List<ChartTDO> countAuditTotal(@Param("state")Integer state, @Param("type")Integer type,
|
| | | @Param("years")String years, @Param("startTime")String startTime, @Param("endTime")String endTime);
|
| | | int countAuditTotal(@Param("state")Integer state, @Param("preDay") String preDay);
|
| | |
|
| | | /**
|
| | | * 统计申请提的现总金额
|
| | | * @param state
|
| | | * @param type
|
| | | * @param years
|
| | | * @param startTime
|
| | | * @param endTime
|
| | | * @return
|
| | | */
|
| | | List<ChartTDO> countExtractMoney(@Param("state")Integer state, @Param("type")Integer type,
|
| | | @Param("years")String years, @Param("startTime")String startTime, @Param("endTime")String endTime);
|
| | | BigDecimal countApplyExtractMoney(@Param("preDay") String preDay);
|
| | |
|
| | | /**
|
| | | * 统计申请提的现总次数
|
| | | * @param state
|
| | | * @param type
|
| | | * @param years
|
| | | * @param startTime
|
| | | * @param endTime
|
| | | * @param preDay
|
| | | * @return
|
| | | */
|
| | | List<ChartTDO> countExtractApplyNumber(@Param("state")Integer state, @Param("type")Integer type,
|
| | | @Param("years")String years, @Param("startTime")String startTime, @Param("endTime")String endTime);
|
| | | int countApplyNumberByDay(@Param("preDay") String preDay);
|
| | |
|
| | | }
|
| | |
| | | @Param("type") Integer hbType, @Param("orderState") Integer orderState,
|
| | | @Param("orderNo") String orderNo, @Param("moneyState") Integer moneyState,
|
| | | @Param("startTime") String startTime, @Param("endTime") String endTime,@Param("listSource") List<Integer> listSource);
|
| | |
|
| | | /**
|
| | | * 统计各个订单类型 有效个数
|
| | | * @param orderType
|
| | | * @param preDay
|
| | | * @return
|
| | | */
|
| | | Integer countOrderByTypeAndDate(@Param("orderType") Integer orderType, @Param("preDay") String preDay);
|
| | | |
| | | |
| | | } |
| | |
| | |
|
| | |
|
| | | long countByHasGoldCoin(@Param("key") String key);
|
| | | |
| | | } |
| | |
| | | * @param channel
|
| | | * @return
|
| | | */
|
| | | List<ChartTDO> countOrderNumber(@Param("dateType") Integer dateType, @Param("year") String year,
|
| | | @Param("startTime") String startTime, @Param("endTime") String endTime);
|
| | | Long countOrderByDay(@Param("preDay") String preDay);
|
| | |
|
| | | } |
| | |
| | | package com.yeshi.fanli.dao.mybatis.order;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | |
|
| | | import org.apache.ibatis.annotations.Param;
|
| | |
|
| | | import com.yeshi.fanli.dto.ChartTDO;
|
| | | import com.yeshi.fanli.dto.order.CountOrderDTO;
|
| | |
|
| | | public interface CommonOrderCountMapper {
|
| | |
|
| | |
| | | */
|
| | | Long countByState(@Param("state") Integer state);
|
| | |
|
| | | |
| | | /**
|
| | | * 统计所有订单
|
| | | *
|
| | | * @param channel
|
| | | * @return
|
| | | */
|
| | | List<ChartTDO> countOrderNumber(@Param("dateType") Integer dateType, @Param("year") String year,
|
| | | @Param("startTime") String startTime, @Param("endTime") String endTime,
|
| | | @Param("sourceType") int sourceType);
|
| | | Long countOrderBySourceTypeAndDay(@Param("preDay") String preDay, @Param("sourceType") int sourceType);
|
| | |
|
| | | |
| | | |
| | | /**
|
| | | * 奖金统计
|
| | | *
|
| | |
| | | */
|
| | | List<Long> getSameGoodsOrderByUidAndHongBaoType(@Param("typeList") List<Integer> typeList, @Param("uid") Long uid,
|
| | | @Param("minSameGoodsOrderCount") int minSameGoodsOrderCount);
|
| | | |
| | | |
| | | /**
|
| | | * 通过uid 日期筛选 下单数量
|
| | | * @param preDay
|
| | | * @param uid |
| | | * @return
|
| | | */
|
| | | Integer countOderByUidAndDate(@Param("preDay") Date preDay,@Param("uid") Long uid);
|
| | | |
| | | /**
|
| | | * 日期筛选 每个用户下单数量
|
| | | * @param preDay
|
| | | * @param uid |
| | | * @return
|
| | | */
|
| | | List<CountOrderDTO> countValidOrderByDay(@Param("preDay") String preDay);
|
| | | |
| | | /**
|
| | | * 通过多个uid 日期筛选 下单用户数量
|
| | | * @param preDay
|
| | | * @param uid |
| | | * @return
|
| | | */
|
| | | Integer countDownOrderUserByUidAndDate(@Param("preDay") Date preDay,@Param("list") List<Long> list);
|
| | | |
| | | /**
|
| | | * 统计订单产生佣金
|
| | | * @param preDay
|
| | | * @param list
|
| | | * @return
|
| | | */
|
| | | List<CountOrderDTO> countCommissionByDay(@Param("preDay") String preDay);
|
| | | |
| | | /**
|
| | | * 通过uid 日期筛选 下单数量
|
| | | * @param preDay
|
| | | * @return
|
| | | */
|
| | | Integer countOderByDate(@Param("preDay") String preDay);
|
| | | |
| | | /**
|
| | | * 统计订单产生佣金
|
| | | * @param preDay
|
| | | * @return
|
| | | */
|
| | | BigDecimal countCommissionByDate(@Param("preDay") String preDay);
|
| | | } |
| | |
| | | package com.yeshi.fanli.dao.mybatis.order;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | |
|
| | | import org.apache.ibatis.annotations.Param;
|
| | |
|
| | | import com.yeshi.fanli.dao.BaseMapper;
|
| | | import com.yeshi.fanli.dto.ChartTDO;
|
| | | import com.yeshi.fanli.entity.bus.user.LostOrder;
|
| | |
|
| | | public interface LostOrderMapper extends BaseMapper<LostOrder> {
|
| | |
| | | /**
|
| | | * 统计申诉订单数量
|
| | | *
|
| | | * @param type
|
| | | * @param state
|
| | | * @param years
|
| | | * @param startTime
|
| | | * @param endTime
|
| | | * @param preDay
|
| | | * @return
|
| | | */
|
| | | List<ChartTDO> countLostNum(@Param("dateType") Integer dateType, @Param("resultCode") Integer resultCode,
|
| | | @Param("year") String year, @Param("startTime") String startTime, @Param("endTime") String endTime);
|
| | | Integer countLostOrderNum(@Param("preDay") String preDay);
|
| | |
|
| | | /**
|
| | | * 统计申诉成功订单金额
|
| | | *
|
| | | * @param type
|
| | | * @param state
|
| | | * @param years
|
| | | * @param startTime
|
| | | * @param endTime
|
| | | * @param preDay
|
| | | * @return
|
| | | */
|
| | | List<ChartTDO> countAppealMoney(@Param("dateType") Integer dateType, @Param("year") String year,
|
| | | @Param("startTime") String startTime, @Param("endTime") String endTime);
|
| | | BigDecimal countAppealMoney(@Param("preDay") String preDay);
|
| | |
|
| | | /**
|
| | | * 根据用户删除
|
| | |
| | | package com.yeshi.fanli.dao.mybatis.order; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import com.yeshi.fanli.dao.BaseMapper; |
| | |
| | | * @return |
| | | */ |
| | | public UserOrderWeiQuanRecord selectByOrderInfoAndUid(@Param("uid") Long uid,@Param("tradeId") String tradeId,@Param("sourceType") int sourceType); |
| | | |
| | | |
| | | |
| | | /** |
| | | * 统计维权订单数量-根据日期 |
| | | * @param preDay |
| | | * @return |
| | | */ |
| | | Integer countWeiQaunOrderNumberByDate(@Param("preDay") String preDay); |
| | | |
| | | |
| | | /** |
| | | * 统计维权订单金额-根据日期 |
| | | * @param preDay |
| | | * @return |
| | | */ |
| | | BigDecimal countWeiQaunOrderMoneyByDate(@Param("preDay") String preDay); |
| | | |
| | | } |
| | |
| | | * @param endTime
|
| | | * @return
|
| | | */
|
| | | List<ChartTDO> countOrderNumber(@Param("dateType") Integer dateType, @Param("year") String year,
|
| | | @Param("startTime") String startTime, @Param("endTime") String endTime);
|
| | |
|
| | | Long countOrderByDay(@Param("preDay") String preDay);
|
| | | |
| | | /**
|
| | | * 根据状态查询数据
|
| | | *
|
| | |
| | | * @param channel
|
| | | * @return
|
| | | */
|
| | | List<ChartTDO> countOrderNumber(@Param("dateType") Integer dateType, @Param("year") String year,
|
| | | @Param("startTime") String startTime, @Param("endTime") String endTime);
|
| | | Long countOrderByDay(@Param("preDay") String preDay);
|
| | | |
| | |
|
| | | /**
|
| | | * 获取长期未更新的订单
|
New file |
| | |
| | | package com.yeshi.fanli.dao.mybatis.user; |
| | | |
| | | import java.util.List; |
| | | |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import com.yeshi.fanli.dao.BaseMapper; |
| | | import com.yeshi.fanli.entity.bus.user.UserInfoRegister; |
| | | |
| | | public interface UserInfoRegisterMapper extends BaseMapper<UserInfoRegister> { |
| | | |
| | | /** |
| | | * 根据多个用户查询 |
| | | * @param list |
| | | * @return |
| | | */ |
| | | List<UserInfoRegister> listByMultipleUids(@Param("list")List<Long> list); |
| | | |
| | | /** |
| | | * 根据多个用户查询 |
| | | * @param list |
| | | * @return |
| | | */ |
| | | List<UserInfoRegister> listByMultipleUidAndDay(@Param("list")List<Long> list, @Param("preDay")String preDay); |
| | | |
| | | |
| | | /** |
| | | * 根据渠道查询用户id |
| | | * @param channel |
| | | * @return |
| | | */ |
| | | List<Long> listUidByChannel(@Param("channel")String channel); |
| | | |
| | | /** |
| | | * 根据渠道查询用户id |
| | | * @param channel |
| | | * @return |
| | | */ |
| | | List<Long> listUidByChannelAndDay(@Param("channel")String channel, @Param("preDay")String preDay); |
| | | |
| | | /** |
| | | * 根据渠道查询用户id |
| | | * @param channel |
| | | * @return |
| | | */ |
| | | List<UserInfoRegister> listByChannelAndDay(@Param("channel")String channel, @Param("preDay")String preDay); |
| | | |
| | | |
| | | /** |
| | | * 统计渠道当日新增个数 |
| | | * @param channel |
| | | * @param preDay |
| | | * @return |
| | | */ |
| | | Integer countByChannelAndDay(@Param("channel")String channel, @Param("preDay")String preDay); |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.fanli.dao.user.count; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | import com.yeshi.fanli.dao.MongodbBaseDao; |
| | | import com.yeshi.fanli.entity.admin.count.CountOrderInfo; |
| | | import com.yeshi.fanli.entity.admin.count.CountOrderInfo.CountOrderEnum; |
| | | import com.yeshi.fanli.util.StringUtil; |
| | | |
| | | @Repository |
| | | public class CountOrderInfoDao extends MongodbBaseDao<CountOrderInfo> { |
| | | |
| | | /** |
| | | * 查询统计最大的一天 |
| | | * |
| | | * @return |
| | | */ |
| | | public CountOrderInfo getMaxDate(CountOrderEnum userEnum) { |
| | | Query query = new Query(); |
| | | query.addCriteria(Criteria.where("type").is(userEnum.name())); |
| | | query.with(new Sort(Sort.Direction.DESC, "day")).limit(1); |
| | | return mongoTemplate.findOne(query, CountOrderInfo.class); |
| | | } |
| | | |
| | | /** |
| | | * 查询视图 |
| | | * |
| | | * @param dateType |
| | | * @param year |
| | | * @param startTime |
| | | * @param endTime |
| | | * @return |
| | | */ |
| | | public List<CountOrderInfo> query(CountOrderEnum userEnum, Date startTime, Date endTime) { |
| | | Query query = new Query(); |
| | | Criteria ca = new Criteria(); |
| | | ca.andOperator(Criteria.where("type").is(userEnum.name()),Criteria.where("day").gte(startTime), Criteria.where("day").lte(endTime)); |
| | | query.addCriteria(ca); |
| | | return mongoTemplate.find(query, CountOrderInfo.class); |
| | | } |
| | | |
| | | /** |
| | | * 查询视图 |
| | | * |
| | | * @param dateType |
| | | * @param year |
| | | * @param startTime |
| | | * @param endTime |
| | | * @return |
| | | */ |
| | | public List<CountOrderInfo> query(CountOrderEnum userEnum, Date startTime, Date endTime, String channel) { |
| | | Query query = new Query(); |
| | | Criteria ca = new Criteria(); |
| | | ca.andOperator(Criteria.where("type").is(userEnum.name()),Criteria.where("day").gte(startTime), Criteria.where("day").lte(endTime)); |
| | | query.addCriteria(ca); |
| | | if (!StringUtil.isNullOrEmpty(channel)) { |
| | | Criteria c2 = Criteria.where("channel").is(channel); |
| | | query.addCriteria(c2); |
| | | } |
| | | return mongoTemplate.find(query, CountOrderInfo.class); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 查询视图 |
| | | * |
| | | * @param dateType |
| | | * @param year |
| | | * @param startTime |
| | | * @param endTime |
| | | * @return |
| | | */ |
| | | public List<CountOrderInfo> query(CountOrderEnum userEnum, Date startTime, Date endTime, Integer state) { |
| | | Query query = new Query(); |
| | | Criteria ca = new Criteria(); |
| | | ca.andOperator(Criteria.where("type").is(userEnum.name()),Criteria.where("day").gte(startTime), Criteria.where("day").lte(endTime)); |
| | | query.addCriteria(ca); |
| | | if (state != null) { |
| | | Criteria c2 = Criteria.where("state").is(state); |
| | | query.addCriteria(c2); |
| | | } |
| | | return mongoTemplate.find(query, CountOrderInfo.class); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.fanli.dao.user.count; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | import com.yeshi.fanli.dao.MongodbBaseDao; |
| | | import com.yeshi.fanli.entity.admin.count.CountOrderTrackRate; |
| | | import com.yeshi.fanli.entity.admin.count.CountOrderTrackRate.OrderTrackRateEnum; |
| | | |
| | | @Repository |
| | | public class CountOrderTrackRateDao extends MongodbBaseDao<CountOrderTrackRate> { |
| | | |
| | | /** |
| | | * 查询统计最大的一天 |
| | | * |
| | | * @return |
| | | */ |
| | | public CountOrderTrackRate getMaxDate(OrderTrackRateEnum userEnum) { |
| | | Query query = new Query(); |
| | | query.addCriteria(Criteria.where("type").is(userEnum.name())); |
| | | query.with(new Sort(Sort.Direction.DESC, "day")).limit(1); |
| | | return mongoTemplate.findOne(query, CountOrderTrackRate.class); |
| | | } |
| | | |
| | | /** |
| | | * 查询视图 |
| | | * |
| | | * @param dateType |
| | | * @param year |
| | | * @param startTime |
| | | * @param endTime |
| | | * @return |
| | | */ |
| | | public List<CountOrderTrackRate> query(OrderTrackRateEnum userEnum, Date startTime, Date endTime) { |
| | | Query query = new Query(); |
| | | Criteria ca = new Criteria(); |
| | | ca.andOperator(Criteria.where("type").is(userEnum.name()),Criteria.where("day").gte(startTime), Criteria.where("day").lte(endTime)); |
| | | query.addCriteria(ca); |
| | | return mongoTemplate.find(query, CountOrderTrackRate.class); |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.fanli.dao.user.count; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | import com.yeshi.fanli.dao.MongodbBaseDao; |
| | | import com.yeshi.fanli.entity.admin.count.CountUserInfo; |
| | | import com.yeshi.fanli.entity.admin.count.CountUserInfo.CountUserEnum; |
| | | import com.yeshi.fanli.util.StringUtil; |
| | | |
| | | @Repository |
| | | public class CountUserInfoDao extends MongodbBaseDao<CountUserInfo> { |
| | | |
| | | /** |
| | | * 查询统计最大的一天 |
| | | * |
| | | * @return |
| | | */ |
| | | public CountUserInfo getMaxDate(CountUserEnum userEnum) { |
| | | Query query = new Query(); |
| | | query.addCriteria(Criteria.where("type").is(userEnum.name())); |
| | | query.with(new Sort(Sort.Direction.DESC, "day")).limit(1); |
| | | return mongoTemplate.findOne(query, CountUserInfo.class); |
| | | } |
| | | |
| | | /** |
| | | * 查询视图 |
| | | * |
| | | * @param dateType |
| | | * @param year |
| | | * @param startTime |
| | | * @param endTime |
| | | * @return |
| | | */ |
| | | public List<CountUserInfo> query(CountUserEnum userEnum, Date startTime, Date endTime) { |
| | | Query query = new Query(); |
| | | Criteria ca = new Criteria(); |
| | | ca.andOperator(Criteria.where("type").is(userEnum.name()),Criteria.where("day").gte(startTime), Criteria.where("day").lte(endTime)); |
| | | query.addCriteria(ca); |
| | | return mongoTemplate.find(query, CountUserInfo.class); |
| | | } |
| | | |
| | | /** |
| | | * 查询视图 |
| | | * |
| | | * @param dateType |
| | | * @param year |
| | | * @param startTime |
| | | * @param endTime |
| | | * @return |
| | | */ |
| | | public List<CountUserInfo> query(CountUserEnum userEnum, Date startTime, Date endTime, String channel) { |
| | | Query query = new Query(); |
| | | Criteria ca = new Criteria(); |
| | | ca.andOperator(Criteria.where("type").is(userEnum.name()),Criteria.where("day").gte(startTime), Criteria.where("day").lte(endTime)); |
| | | query.addCriteria(ca); |
| | | if (!StringUtil.isNullOrEmpty(channel)) { |
| | | Criteria c2 = Criteria.where("channel").is(channel); |
| | | query.addCriteria(c2); |
| | | } |
| | | return mongoTemplate.find(query, CountUserInfo.class); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 查询视图 |
| | | * |
| | | * @param dateType |
| | | * @param year |
| | | * @param startTime |
| | | * @param endTime |
| | | * @return |
| | | */ |
| | | public List<CountUserInfo> query(CountUserEnum userEnum, Date startTime, Date endTime, Integer state) { |
| | | Query query = new Query(); |
| | | Criteria ca = new Criteria(); |
| | | ca.andOperator(Criteria.where("type").is(userEnum.name()),Criteria.where("day").gte(startTime), Criteria.where("day").lte(endTime)); |
| | | query.addCriteria(ca); |
| | | if (state != null) { |
| | | Criteria c2 = Criteria.where("state").is(state); |
| | | query.addCriteria(c2); |
| | | } |
| | | return mongoTemplate.find(query, CountUserInfo.class); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.fanli.dto.order; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | public class CountOrderDTO { |
| | | // 用户id |
| | | private Long uid; |
| | | // 订单数 |
| | | private Integer totalOrder; |
| | | // 佣金 |
| | | private BigDecimal commission; |
| | | |
| | | public Long getUid() { |
| | | return uid; |
| | | } |
| | | |
| | | public void setUid(Long uid) { |
| | | this.uid = uid; |
| | | } |
| | | |
| | | public Integer getTotalOrder() { |
| | | return totalOrder; |
| | | } |
| | | |
| | | public void setTotalOrder(Integer totalOrder) { |
| | | this.totalOrder = totalOrder; |
| | | } |
| | | |
| | | public BigDecimal getCommission() { |
| | | return commission; |
| | | } |
| | | |
| | | public void setCommission(BigDecimal commission) { |
| | | this.commission = commission; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.fanli.entity.admin.count; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | |
| | | import org.springframework.data.mongodb.core.mapping.Field; |
| | | |
| | | /** |
| | | * 订单统计 |
| | | * |
| | | * @author Administrator |
| | | * |
| | | */ |
| | | public class CountOrderInfo { |
| | | public enum CountOrderEnum { |
| | | channelTotal("订单渠道统计"), |
| | | oder24H("新人24小时产生订单"), |
| | | channelCommission("订单佣金"), |
| | | orderType("订单类型数量"), |
| | | weiQuanNum("订单维权数量"), |
| | | weiQuanMoney("订单维权金额"), |
| | | lastNum("订单找回数量"), |
| | | lastMoney("订单找回金额"), |
| | | totalNum("总订单数量"), |
| | | totalCommission("总订单佣金"); |
| | | |
| | | private final String desc; |
| | | |
| | | private CountOrderEnum(String desc) { |
| | | this.desc = desc; |
| | | } |
| | | |
| | | public String getDesc() { |
| | | return desc; |
| | | } |
| | | } |
| | | |
| | | @Field("_id") |
| | | private String id; |
| | | // 日期 |
| | | @Field("day") |
| | | private Date day; |
| | | // 数量 |
| | | @Field("num") |
| | | private Integer num; |
| | | // 金额 |
| | | @Field("money") |
| | | private BigDecimal money; |
| | | |
| | | @Field("state") |
| | | private Integer state; |
| | | // 类型 |
| | | @Field("type") |
| | | private String type; |
| | | // 渠道 |
| | | @Field("channel") |
| | | private String channel; |
| | | |
| | | public String getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(String id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public Date getDay() { |
| | | return day; |
| | | } |
| | | |
| | | public void setDay(Date day) { |
| | | this.day = day; |
| | | } |
| | | |
| | | public Integer getNum() { |
| | | return num; |
| | | } |
| | | |
| | | public void setNum(Integer num) { |
| | | this.num = num; |
| | | } |
| | | |
| | | public BigDecimal getMoney() { |
| | | return money; |
| | | } |
| | | |
| | | public void setMoney(BigDecimal money) { |
| | | this.money = money; |
| | | } |
| | | |
| | | public Integer getState() { |
| | | return state; |
| | | } |
| | | |
| | | public void setState(Integer state) { |
| | | this.state = state; |
| | | } |
| | | |
| | | public String getType() { |
| | | return type; |
| | | } |
| | | |
| | | public void setType(String type) { |
| | | this.type = type; |
| | | } |
| | | |
| | | public String getChannel() { |
| | | return channel; |
| | | } |
| | | |
| | | public void setChannel(String channel) { |
| | | this.channel = channel; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.fanli.entity.admin.count; |
| | | |
| | | import java.util.Date; |
| | | |
| | | import org.springframework.data.mongodb.core.mapping.Field; |
| | | |
| | | /** |
| | | * 订单跟踪率 |
| | | * |
| | | * @author Administrator |
| | | * |
| | | */ |
| | | public class CountOrderTrackRate { |
| | | public enum OrderTrackRateEnum { |
| | | taobao(1,"订单渠道统计"), jd(2,"新人24小时产生订单"), pdd(3,"订单佣金"); |
| | | |
| | | private final int value; |
| | | private final String desc; |
| | | |
| | | private OrderTrackRateEnum(int value, String desc) { |
| | | this.value = value; |
| | | this.desc = desc; |
| | | } |
| | | |
| | | public String getDesc() { |
| | | return desc; |
| | | } |
| | | |
| | | public int getValue() { |
| | | return value; |
| | | } |
| | | } |
| | | |
| | | @Field("_id") |
| | | private String id; |
| | | // 日期 |
| | | @Field("day") |
| | | private Date day; |
| | | // 数量 |
| | | @Field("num") |
| | | private Long num; |
| | | // 金额 |
| | | @Field("money") |
| | | private Long totalNum; |
| | | // 类型 |
| | | @Field("type") |
| | | private String type; |
| | | |
| | | public String getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(String id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public Date getDay() { |
| | | return day; |
| | | } |
| | | |
| | | public void setDay(Date day) { |
| | | this.day = day; |
| | | } |
| | | |
| | | public Long getNum() { |
| | | return num; |
| | | } |
| | | |
| | | public void setNum(Long num) { |
| | | this.num = num; |
| | | } |
| | | |
| | | public Long getTotalNum() { |
| | | return totalNum; |
| | | } |
| | | |
| | | public void setTotalNum(Long totalNum) { |
| | | this.totalNum = totalNum; |
| | | } |
| | | |
| | | public String getType() { |
| | | return type; |
| | | } |
| | | |
| | | public void setType(String type) { |
| | | this.type = type; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.fanli.entity.admin.count; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | import org.springframework.data.mongodb.core.mapping.Field; |
| | | |
| | | /** |
| | | * 渠道订单统计 |
| | | * |
| | | * @author Administrator |
| | | * |
| | | */ |
| | | @Document(collection = "CountUserInfo") |
| | | public class CountUserInfo { |
| | | |
| | | public enum CountUserEnum { |
| | | newUser("其他"), |
| | | extractApplyNumber("提现申请次数"), |
| | | extractApplyMoney("提现申请次数"), |
| | | extractAuditNumber("提现审核次数"), |
| | | todayOrder("当日订单的用户数量"), |
| | | weekOrder("7天内订单用户数量"), |
| | | weekThreeOrder("7天内订单用户数量"),; |
| | | |
| | | private final String desc; |
| | | |
| | | private CountUserEnum(String desc) { |
| | | this.desc = desc; |
| | | } |
| | | |
| | | public String getDesc() { |
| | | return desc; |
| | | } |
| | | } |
| | | |
| | | @Field("_id") |
| | | private String id; |
| | | // 日期 |
| | | @Field("day") |
| | | private Date day; |
| | | // 数量 |
| | | @Field("num") |
| | | private Integer num; |
| | | // 金额 |
| | | @Field("money") |
| | | private BigDecimal money; |
| | | |
| | | @Field("state") |
| | | private Integer state; |
| | | // 类型 |
| | | @Field("type") |
| | | private CountUserEnum type; |
| | | // 渠道 |
| | | @Field("channel") |
| | | private String channel; |
| | | |
| | | public String getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(String id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public Date getDay() { |
| | | return day; |
| | | } |
| | | |
| | | public void setDay(Date day) { |
| | | this.day = day; |
| | | } |
| | | |
| | | public Integer getNum() { |
| | | return num; |
| | | } |
| | | |
| | | public void setNum(Integer num) { |
| | | this.num = num; |
| | | } |
| | | |
| | | public BigDecimal getMoney() { |
| | | return money; |
| | | } |
| | | |
| | | public void setMoney(BigDecimal money) { |
| | | this.money = money; |
| | | } |
| | | |
| | | public CountUserEnum getType() { |
| | | return type; |
| | | } |
| | | |
| | | public void setType(CountUserEnum type) { |
| | | this.type = type; |
| | | } |
| | | |
| | | public String getChannel() { |
| | | return channel; |
| | | } |
| | | |
| | | public void setChannel(String channel) { |
| | | this.channel = channel; |
| | | } |
| | | |
| | | public Integer getState() { |
| | | return state; |
| | | } |
| | | |
| | | public void setState(Integer state) { |
| | | this.state = state; |
| | | } |
| | | |
| | | } |
| | |
| | | private String portrait;
|
| | | @Column(name = "au_create_time")
|
| | | private Date createTime;
|
| | | |
| | | // 标签
|
| | | @Expose
|
| | | @Column(name = "au_tag")
|
| | | private String tag;
|
| | | |
| | |
|
| | | public String getNickName() {
|
| | | return nickName;
|
| | |
| | | public void setCreateTime(Date createTime) {
|
| | | this.createTime = createTime;
|
| | | }
|
| | |
|
| | | public String getTag() {
|
| | | return tag;
|
| | | }
|
| | |
|
| | | public void setTag(String tag) {
|
| | | this.tag = tag;
|
| | | }
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.entity.bus.user;
|
| | |
|
| | | import java.util.Date;
|
| | |
|
| | | import org.yeshi.utils.mybatis.Column;
|
| | | import org.yeshi.utils.mybatis.Table;
|
| | |
|
| | | import com.yeshi.fanli.entity.system.ChannelEnum;
|
| | |
|
| | | /**
|
| | | * 首次注册信息
|
| | | * |
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | @Table("yeshi_ec_user_info_register")
|
| | | public class UserInfoRegister {
|
| | | // 用户id
|
| | | @Column(name = "regt_id")
|
| | | private Long id;
|
| | | // 渠道
|
| | | @Column(name = "regt_channel")
|
| | | private ChannelEnum channel;
|
| | | // ip : 端口
|
| | | @Column(name = "regt_ip")
|
| | | private String ip;
|
| | | // 设备
|
| | | @Column(name = "regt_device")
|
| | | private String device;
|
| | | // 时间
|
| | | @Column(name = "regt_create_time")
|
| | | private Date createTime;
|
| | |
|
| | | public Long getId() {
|
| | | return id;
|
| | | }
|
| | |
|
| | | public void setId(Long id) {
|
| | | this.id = id;
|
| | | }
|
| | |
|
| | | public ChannelEnum getChannel() {
|
| | | return channel;
|
| | | }
|
| | |
|
| | | public void setChannel(ChannelEnum channel) {
|
| | | this.channel = channel;
|
| | | }
|
| | |
|
| | | public String getIp() {
|
| | | return ip;
|
| | | }
|
| | |
|
| | | public void setIp(String ip) {
|
| | | this.ip = ip;
|
| | | }
|
| | |
|
| | | public String getDevice() {
|
| | | return device;
|
| | | }
|
| | |
|
| | | public void setDevice(String device) {
|
| | | this.device = device;
|
| | | }
|
| | |
|
| | | public Date getCreateTime() {
|
| | | return createTime;
|
| | | }
|
| | |
|
| | | public void setCreateTime(Date createTime) {
|
| | | this.createTime = createTime;
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.entity.dynamic; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import com.google.gson.annotations.Expose; |
| | | import com.yeshi.fanli.vo.msg.ClientTextStyleVO; |
| | | |
| | | public class CommentInfo implements Serializable { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | public enum CommentInfoEnum { |
| | | goodsCoupon(1,"商品优惠券"), currencyCoupon(2,"通用优惠券"); |
| | | |
| | | private final int vlaue; |
| | | private final String desc; |
| | | |
| | | private CommentInfoEnum(int vlaue, String desc) { |
| | | this.vlaue = vlaue; |
| | | this.desc = desc; |
| | | } |
| | | |
| | | public String getDesc() { |
| | | return desc; |
| | | } |
| | | |
| | | public int getVlaue() { |
| | | return vlaue; |
| | | } |
| | | } |
| | | |
| | | @Expose |
| | | private String id; |
| | | // 类型 |
| | | @Expose |
| | | private CommentInfoEnum type; |
| | | // 内容 |
| | | @Expose |
| | | private String content; |
| | | // 标签 |
| | | @Expose |
| | | private List<ClientTextStyleVO> tagList; |
| | | // 标签说明 |
| | | @Expose |
| | | private String tagDesc; |
| | | // h5 |
| | | @Expose |
| | | private String tagUrl; |
| | | |
| | | private Integer weight; |
| | | // 券信息 |
| | | private String coupon; |
| | | // 券来源 |
| | | private String couponSource; |
| | | // 结束时间 |
| | | // @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | // private Date endTime; |
| | | |
| | | private String tags; |
| | | private String tagsColour; |
| | | private String endTime; |
| | | |
| | | public CommentInfoEnum getType() { |
| | | return type; |
| | | } |
| | | |
| | | public void setType(CommentInfoEnum type) { |
| | | this.type = type; |
| | | } |
| | | |
| | | public String getContent() { |
| | | return content; |
| | | } |
| | | |
| | | public void setContent(String content) { |
| | | this.content = content; |
| | | } |
| | | |
| | | public List<ClientTextStyleVO> getTagList() { |
| | | return tagList; |
| | | } |
| | | |
| | | public void setTagList(List<ClientTextStyleVO> tagList) { |
| | | this.tagList = tagList; |
| | | } |
| | | |
| | | public String getTagDesc() { |
| | | return tagDesc; |
| | | } |
| | | |
| | | public void setTagDesc(String tagDesc) { |
| | | this.tagDesc = tagDesc; |
| | | } |
| | | |
| | | public String getTags() { |
| | | return tags; |
| | | } |
| | | |
| | | public void setTags(String tags) { |
| | | this.tags = tags; |
| | | } |
| | | |
| | | public String getTagsColour() { |
| | | return tagsColour; |
| | | } |
| | | |
| | | public void setTagsColour(String tagsColour) { |
| | | this.tagsColour = tagsColour; |
| | | } |
| | | |
| | | public Integer getWeight() { |
| | | return weight; |
| | | } |
| | | |
| | | public void setWeight(Integer weight) { |
| | | this.weight = weight; |
| | | } |
| | | |
| | | public String getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(String id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getTagUrl() { |
| | | return tagUrl; |
| | | } |
| | | |
| | | public void setTagUrl(String tagUrl) { |
| | | this.tagUrl = tagUrl; |
| | | } |
| | | |
| | | public String getCoupon() { |
| | | return coupon; |
| | | } |
| | | |
| | | public void setCoupon(String coupon) { |
| | | this.coupon = coupon; |
| | | } |
| | | |
| | | public String getCouponSource() { |
| | | return couponSource; |
| | | } |
| | | |
| | | public void setCouponSource(String couponSource) { |
| | | this.couponSource = couponSource; |
| | | } |
| | | |
| | | public String getEndTime() { |
| | | return endTime; |
| | | } |
| | | |
| | | public void setEndTime(String endTime) { |
| | | this.endTime = endTime; |
| | | } |
| | | } |
New file |
| | |
| | | package com.yeshi.fanli.entity.dynamic; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | import org.springframework.data.annotation.Id; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | import org.springframework.data.mongodb.core.mapping.Field; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import com.google.gson.annotations.Expose; |
| | | import com.yeshi.fanli.entity.bus.activity.ActivityUser; |
| | | import com.yeshi.fanli.vo.goods.GoodsDetailVO; |
| | | |
| | | /** |
| | | * 动态商品测评 |
| | | * |
| | | * @author Administrator |
| | | * |
| | | */ |
| | | @Document(collection = "goods_evaluate") |
| | | public class GoodsEvaluate implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | // 图片格式: 一排显示: 0无图 1一张 2两张 3张 |
| | | public final static int LINE_NUM_ZERO = 0; |
| | | public final static int LINE_NUM_ONE = 1; |
| | | public final static int LINE_NUM_TWO = 2; |
| | | public final static int LINE_NUM_THREE = 3; |
| | | |
| | | public enum EvaluateEnum { |
| | | single("单品"), multiple("多品"), activity("活动"); |
| | | |
| | | private final String desc; |
| | | |
| | | private EvaluateEnum(String desc) { |
| | | this.desc = desc; |
| | | } |
| | | |
| | | public String getDesc() { |
| | | return desc; |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | @Id |
| | | @Expose |
| | | @Field("_id") |
| | | private String id; |
| | | |
| | | // 类型 |
| | | @Field("type") |
| | | private EvaluateEnum type; |
| | | |
| | | @Expose |
| | | @Field("user") |
| | | private ActivityUser user; // 发布用户 |
| | | |
| | | @Expose |
| | | @Field("title") |
| | | private String title; // 发布内容 |
| | | |
| | | @Expose |
| | | @Field("shareNum") |
| | | private Integer shareNum; // 分享次数 |
| | | |
| | | // 图片一行显示: 0无图 1一张 2两张 3张 |
| | | @Expose |
| | | @Field("lineNum") |
| | | private Integer lineNum; |
| | | |
| | | @Expose |
| | | @Field("imgList") |
| | | private List<ImgInfo> imgList; // 图片信息 |
| | | |
| | | |
| | | @Field("shareNumReal") |
| | | private Integer shareNumReal; // 分享次数真实 |
| | | |
| | | @Expose |
| | | @Field("goods") |
| | | private GoodsDetailVO goods; // 商品信息 |
| | | |
| | | @Expose |
| | | @Field("comments") |
| | | private List<CommentInfo> comments; // 评论信息 |
| | | |
| | | @Expose |
| | | @Field("publishTime") |
| | | private Date publishTime; // 发布时间 |
| | | |
| | | |
| | | @Field("state") |
| | | private Integer state; // 状态 |
| | | |
| | | @Field("weight") |
| | | private Double weight; // 权重 |
| | | |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @Field("startTime") |
| | | private Date startTime; // 开始时间 |
| | | |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @Field("endTime") |
| | | private Date endTime; // 结束时间 |
| | | |
| | | |
| | | @Field("createTime") |
| | | private Date createTime; // 创建时间 |
| | | |
| | | @Field("updateTime") |
| | | private Date updateTime; // 更新时间 |
| | | |
| | | @Field("mainPicNum") |
| | | private Integer mainPicNum; // 图片主图 |
| | | |
| | | |
| | | |
| | | private String startTimeChar; |
| | | private String endTimeChar; |
| | | |
| | | public String getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(String id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public ActivityUser getUser() { |
| | | return user; |
| | | } |
| | | |
| | | public void setUser(ActivityUser user) { |
| | | this.user = user; |
| | | } |
| | | |
| | | public String getTitle() { |
| | | return title; |
| | | } |
| | | |
| | | public void setTitle(String title) { |
| | | this.title = title; |
| | | } |
| | | |
| | | public List<ImgInfo> getImgList() { |
| | | return imgList; |
| | | } |
| | | |
| | | public void setImgList(List<ImgInfo> imgList) { |
| | | this.imgList = imgList; |
| | | } |
| | | |
| | | public Integer getLineNum() { |
| | | return lineNum; |
| | | } |
| | | |
| | | public void setLineNum(Integer lineNum) { |
| | | this.lineNum = lineNum; |
| | | } |
| | | |
| | | public Integer getShareNum() { |
| | | return shareNum; |
| | | } |
| | | |
| | | public void setShareNum(Integer shareNum) { |
| | | this.shareNum = shareNum; |
| | | } |
| | | |
| | | public GoodsDetailVO getGoods() { |
| | | return goods; |
| | | } |
| | | |
| | | public void setGoods(GoodsDetailVO goods) { |
| | | this.goods = goods; |
| | | } |
| | | |
| | | public List<CommentInfo> getComments() { |
| | | return comments; |
| | | } |
| | | |
| | | public void setComments(List<CommentInfo> comments) { |
| | | this.comments = comments; |
| | | } |
| | | |
| | | public Date getCreateTime() { |
| | | return createTime; |
| | | } |
| | | |
| | | public void setCreateTime(Date createTime) { |
| | | this.createTime = createTime; |
| | | } |
| | | |
| | | public Date getUpdateTime() { |
| | | return updateTime; |
| | | } |
| | | |
| | | public void setUpdateTime(Date updateTime) { |
| | | this.updateTime = updateTime; |
| | | } |
| | | |
| | | public Integer getState() { |
| | | return state; |
| | | } |
| | | |
| | | public void setState(Integer state) { |
| | | this.state = state; |
| | | } |
| | | |
| | | public Double getWeight() { |
| | | return weight; |
| | | } |
| | | |
| | | public void setWeight(Double weight) { |
| | | this.weight = weight; |
| | | } |
| | | |
| | | public Date getStartTime() { |
| | | return startTime; |
| | | } |
| | | |
| | | public void setStartTime(Date startTime) { |
| | | this.startTime = startTime; |
| | | } |
| | | |
| | | public Date getEndTime() { |
| | | return endTime; |
| | | } |
| | | |
| | | public void setEndTime(Date endTime) { |
| | | this.endTime = endTime; |
| | | } |
| | | |
| | | public Integer getShareNumReal() { |
| | | return shareNumReal; |
| | | } |
| | | |
| | | public void setShareNumReal(Integer shareNumReal) { |
| | | this.shareNumReal = shareNumReal; |
| | | } |
| | | |
| | | public String getStartTimeChar() { |
| | | return startTimeChar; |
| | | } |
| | | |
| | | public void setStartTimeChar(String startTimeChar) { |
| | | this.startTimeChar = startTimeChar; |
| | | } |
| | | |
| | | public String getEndTimeChar() { |
| | | return endTimeChar; |
| | | } |
| | | |
| | | public void setEndTimeChar(String endTimeChar) { |
| | | this.endTimeChar = endTimeChar; |
| | | } |
| | | |
| | | public Date getPublishTime() { |
| | | return publishTime; |
| | | } |
| | | |
| | | public void setPublishTime(Date publishTime) { |
| | | this.publishTime = publishTime; |
| | | } |
| | | |
| | | public Integer getMainPicNum() { |
| | | return mainPicNum; |
| | | } |
| | | |
| | | public void setMainPicNum(Integer mainPicNum) { |
| | | this.mainPicNum = mainPicNum; |
| | | } |
| | | |
| | | public EvaluateEnum getType() { |
| | | return type; |
| | | } |
| | | |
| | | public void setType(EvaluateEnum type) { |
| | | this.type = type; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.fanli.entity.dynamic; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | import com.google.gson.annotations.Expose; |
| | | |
| | | public class ImgInfo implements Serializable { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | public enum ImgEnum { |
| | | img(1, "图片"), goods(2, "商品"), video(3, "视频"), activity(4, "活动"); |
| | | |
| | | private final int vlaue; |
| | | private final String desc; |
| | | |
| | | private ImgEnum(int vlaue, String desc) { |
| | | this.vlaue = vlaue; |
| | | this.desc = desc; |
| | | } |
| | | |
| | | public String getDesc() { |
| | | return desc; |
| | | } |
| | | |
| | | public int getVlaue() { |
| | | return vlaue; |
| | | } |
| | | } |
| | | |
| | | private String id; |
| | | // 上级id |
| | | private String pid; |
| | | |
| | | // 类型 |
| | | @Expose |
| | | private ImgEnum type; |
| | | // 图片链接 |
| | | @Expose |
| | | private String url; |
| | | // 高清图片链接 |
| | | @Expose |
| | | private String urlHD; |
| | | // 视频链接 |
| | | @Expose |
| | | private String videoUrl; |
| | | // 宽度 |
| | | @Expose |
| | | private Integer w; |
| | | // 高度 |
| | | @Expose |
| | | private Integer h; |
| | | // 是否大图 |
| | | @Expose |
| | | private boolean large; |
| | | // 商品信息 |
| | | @Expose |
| | | private SimpleGoods goods; |
| | | |
| | | private String activityPic; |
| | | private String activityUrl; |
| | | |
| | | public ImgEnum getType() { |
| | | return type; |
| | | } |
| | | |
| | | public void setType(ImgEnum type) { |
| | | this.type = type; |
| | | } |
| | | |
| | | public String getUrl() { |
| | | return url; |
| | | } |
| | | |
| | | public void setUrl(String url) { |
| | | this.url = url; |
| | | } |
| | | |
| | | public Integer getW() { |
| | | return w; |
| | | } |
| | | |
| | | public void setW(Integer w) { |
| | | this.w = w; |
| | | } |
| | | |
| | | public Integer getH() { |
| | | return h; |
| | | } |
| | | |
| | | public void setH(Integer h) { |
| | | this.h = h; |
| | | } |
| | | |
| | | public SimpleGoods getGoods() { |
| | | return goods; |
| | | } |
| | | |
| | | public void setGoods(SimpleGoods goods) { |
| | | this.goods = goods; |
| | | } |
| | | |
| | | public String getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(String id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getUrlHD() { |
| | | return urlHD; |
| | | } |
| | | |
| | | public void setUrlHD(String urlHD) { |
| | | this.urlHD = urlHD; |
| | | } |
| | | |
| | | public String getVideoUrl() { |
| | | return videoUrl; |
| | | } |
| | | |
| | | public void setVideoUrl(String videoUrl) { |
| | | this.videoUrl = videoUrl; |
| | | } |
| | | |
| | | public boolean isLarge() { |
| | | return large; |
| | | } |
| | | |
| | | public void setLarge(boolean large) { |
| | | this.large = large; |
| | | } |
| | | |
| | | public String getPid() { |
| | | return pid; |
| | | } |
| | | |
| | | public void setPid(String pid) { |
| | | this.pid = pid; |
| | | } |
| | | |
| | | public String getActivityUrl() { |
| | | return activityUrl; |
| | | } |
| | | |
| | | public void setActivityUrl(String activityUrl) { |
| | | this.activityUrl = activityUrl; |
| | | } |
| | | |
| | | public String getActivityPic() { |
| | | return activityPic; |
| | | } |
| | | |
| | | public void setActivityPic(String activityPic) { |
| | | this.activityPic = activityPic; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.fanli.entity.dynamic; |
| | | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | |
| | | import com.google.gson.annotations.Expose; |
| | | |
| | | public class SimpleGoods implements Serializable { |
| | | private static final long serialVersionUID = 1L; |
| | | // 商品ID |
| | | @Expose |
| | | private Long goodsId; |
| | | // 商品类型 1-淘宝 2-京东 3-拼多多 |
| | | @Expose |
| | | private Integer goodsType; |
| | | // 券后价 |
| | | @Expose |
| | | private BigDecimal price; |
| | | // 券面额 |
| | | @Expose |
| | | private BigDecimal amount; |
| | | |
| | | // 状态 |
| | | @Expose |
| | | private Integer state; |
| | | |
| | | public Long getGoodsId() { |
| | | return goodsId; |
| | | } |
| | | |
| | | public void setGoodsId(Long goodsId) { |
| | | this.goodsId = goodsId; |
| | | } |
| | | |
| | | public Integer getGoodsType() { |
| | | return goodsType; |
| | | } |
| | | |
| | | public void setGoodsType(Integer goodsType) { |
| | | this.goodsType = goodsType; |
| | | } |
| | | |
| | | public BigDecimal getPrice() { |
| | | return price; |
| | | } |
| | | |
| | | public void setPrice(BigDecimal price) { |
| | | this.price = price; |
| | | } |
| | | |
| | | public BigDecimal getAmount() { |
| | | return amount; |
| | | } |
| | | |
| | | public void setAmount(BigDecimal amount) { |
| | | this.amount = amount; |
| | | } |
| | | |
| | | public Integer getState() { |
| | | return state; |
| | | } |
| | | |
| | | public void setState(Integer state) { |
| | | this.state = state; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.fanli.entity.system; |
| | | |
| | | public enum ChannelEnum { |
| | | unknown("unknown","未知"), |
| | | p360("360","360"), |
| | | appstore("appstore","appstore"), |
| | | douyin("douyin","抖音"), |
| | | guanwang("GuanWang","官网"), |
| | | lenovo("Lenovo","联想"), |
| | | meizu("meizu","魅族"), |
| | | oppo("OPPO","oppo"), |
| | | pp("PP","pp"), |
| | | qq("QQ","qq"), |
| | | sougou("Sougou","搜狗"), |
| | | vivo("VIVO","vivo"), |
| | | xiaomi("xiaomi","小米"), |
| | | yaoqing("yaoqing","邀请"), |
| | | yingyin("Yingyin","影音"), |
| | | huawei("huawei","华为"); |
| | | |
| | | private final String vlaue; |
| | | private final String desc; |
| | | |
| | | private ChannelEnum(String vlaue ,String desc) { |
| | | this.vlaue = vlaue; |
| | | this.desc = desc; |
| | | } |
| | | |
| | | public String getDesc() { |
| | | return desc; |
| | | } |
| | | |
| | | public String getVlaue() { |
| | | return vlaue; |
| | | } |
| | | } |
New file |
| | |
| | | package com.yeshi.fanli.exception.dynamic; |
| | | |
| | | import com.yeshi.fanli.exception.BaseException; |
| | | |
| | | public class ActivityUserException extends BaseException { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | public ActivityUserException(int code, String msg) { |
| | | super(code, msg); |
| | | } |
| | | |
| | | public ActivityUserException() { |
| | | super(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.yeshi.fanli.exception.dynamic; |
| | | |
| | | import com.yeshi.fanli.exception.BaseException; |
| | | |
| | | public class GoodsEvaluateException extends BaseException { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | public GoodsEvaluateException(int code, String msg) { |
| | | super(code, msg); |
| | | } |
| | | |
| | | public GoodsEvaluateException() { |
| | | super(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.yeshi.fanli.job; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import org.springframework.stereotype.Component; |
| | | import org.yeshi.utils.DateUtil; |
| | | |
| | | import com.xxl.job.core.biz.model.ReturnT; |
| | | import com.xxl.job.core.handler.annotation.XxlJob; |
| | | import com.yeshi.fanli.entity.admin.count.CountOrderInfo; |
| | | import com.yeshi.fanli.entity.admin.count.CountOrderInfo.CountOrderEnum; |
| | | import com.yeshi.fanli.entity.brand.BrandInfo; |
| | | import com.yeshi.fanli.log.LogHelper; |
| | | import com.yeshi.fanli.service.inter.count.UserInfoCountService; |
| | | import com.yeshi.fanli.util.Constant; |
| | | import com.yeshi.fanli.util.TimeUtil; |
| | | |
| | | /** |
| | | * 统计用户信息 |
| | | * |
| | | * @author Administrator |
| | | * |
| | | */ |
| | | @Component |
| | | public class CountUserInfoJob { |
| | | |
| | | @Resource |
| | | private UserInfoCountService userInfoCountService; |
| | | |
| | | /** |
| | | * 每天更新一次 数据统计 |
| | | */ |
| | | @XxlJob("countUserInfoJobHandler") |
| | | public ReturnT<String> countUserJobHandler(String param) throws Exception { |
| | | countInfo(); |
| | | return ReturnT.SUCCESS; |
| | | } |
| | | |
| | | private void countInfo() { |
| | | if (!Constant.IS_TASK) |
| | | return; |
| | | userInfoCountService.initCountUserWeekOrder(); |
| | | } |
| | | |
| | | } |
| | |
| | |
|
| | |
|
| | |
|
| | | <select id="countAuditTotal" resultMap="ChartMap">
|
| | | SELECT COALESCE(COUNT(tr.id),0) AS 'showValue',
|
| | | <if test="type == 1">
|
| | | FROM_UNIXTIME(tr.`auditTime`/1000,'%Y-%m-%d') AS
|
| | | 'showDate'
|
| | | </if>
|
| | | <if test="type == 2">
|
| | | FROM_UNIXTIME(tr.`auditTime`/1000,'%m') AS 'showDate'
|
| | | </if>
|
| | | <if test="type == 3">
|
| | | FROM_UNIXTIME(tr.`auditTime`/1000,'%Y') AS 'showDate'
|
| | | </if>
|
| | | FROM `yeshi_ec_extract_audit_record` tr
|
| | | <if test="state != null and state != 0">
|
| | | LEFT JOIN `yeshi_ec_extract` t ON t.`id` = tr.`extractId`
|
| | | </if>
|
| | | WHERE tr.`auditTime` IS NOT NULL
|
| | | <if test="startTime != null and startTime != '' ">
|
| | | AND FROM_UNIXTIME(tr.`auditTime`/1000,'%Y-%m-%d')<![CDATA[ >= ]]>'${startTime}'
|
| | | </if>
|
| | | <if test="endTime != null and endTime != '' ">
|
| | | AND FROM_UNIXTIME(tr.`auditTime`/1000,'%Y-%m-%d') <![CDATA[ <= ]]>
|
| | | '${endTime}'
|
| | | </if>
|
| | | <if test="years != null and years != '' ">
|
| | | AND FROM_UNIXTIME(tr.`auditTime`/1000,'%Y') = '${years}'
|
| | | </if>
|
| | | <if test="state != null and state != 3">
|
| | | AND t.`state` = ${state}
|
| | | </if>
|
| | | <if test="type == 1">
|
| | | GROUP BY FROM_UNIXTIME(tr.`auditTime`/1000,'%Y-%m-%d')
|
| | | </if>
|
| | | <if test="type == 2">
|
| | | GROUP BY FROM_UNIXTIME(tr.`auditTime`/1000,'%Y-%m')
|
| | | </if>
|
| | | <if test="type == 3">
|
| | | GROUP BY FROM_UNIXTIME(tr.`auditTime`/1000,'%Y')
|
| | | </if>
|
| | | ORDER BY tr.`auditTime`
|
| | | <select id="countAuditTotal" resultType="Integer">
|
| | | SELECT IFNULL(COUNT(tr.id),0) FROM `yeshi_ec_extract_audit_record` tr
|
| | | LEFT JOIN `yeshi_ec_extract` t ON t.`id` = tr.`extractId`
|
| | | WHERE t.`state` = #{state} AND FROM_UNIXTIME(tr.`auditTime`/1000,'%Y-%m-%d') = #{preDay} |
| | | </select>
|
| | |
|
| | | <select id="countExtractMoney" resultMap="ChartMap">
|
| | | SELECT CAST(SUM(t.`money`)AS DECIMAL(19,2)) AS showValue,
|
| | | <if test="type == 1">
|
| | | FROM_UNIXTIME(t.`extractTime`/1000,'%Y-%m-%d') AS
|
| | | 'showDate'
|
| | | </if>
|
| | | <if test="type == 2">
|
| | | FROM_UNIXTIME(t.`extractTime`/1000,'%m') AS 'showDate'
|
| | | </if>
|
| | | <if test="type == 3">
|
| | | FROM_UNIXTIME(t.`extractTime`/1000,'%Y') AS 'showDate'
|
| | | </if>
|
| | | FROM `yeshi_ec_extract` t
|
| | | WHERE t.`extractTime` IS NOT NULL
|
| | | <if test="startTime != null and startTime != '' ">
|
| | | AND FROM_UNIXTIME(t.`extractTime`/1000,'%Y-%m-%d')<![CDATA[ >= ]]>'${startTime}'
|
| | | </if>
|
| | | <if test="endTime != null and endTime != '' ">
|
| | | AND FROM_UNIXTIME(t.`extractTime`/1000,'%Y-%m-%d') <![CDATA[ <= ]]>
|
| | | '${endTime}'
|
| | | </if>
|
| | | <if test="years != null and years != '' ">
|
| | | AND FROM_UNIXTIME(t.`extractTime`/1000,'%Y') = '${years}'
|
| | | </if>
|
| | | <if test="state != null">
|
| | | AND t.`state` = ${state}
|
| | | </if>
|
| | | <if test="type == 1">
|
| | | GROUP BY FROM_UNIXTIME(t.`extractTime`/1000,'%Y-%m-%d')
|
| | | </if>
|
| | | <if test="type == 2">
|
| | | GROUP BY FROM_UNIXTIME(t.`extractTime`/1000,'%Y-%m')
|
| | | </if>
|
| | | <if test="type == 3">
|
| | | GROUP BY FROM_UNIXTIME(t.`extractTime`/1000,'%Y')
|
| | | </if>
|
| | | ORDER BY t.`extractTime`
|
| | | <select id="countApplyExtractMoney" resultType="BigDecimal">
|
| | | SELECT SUM(t.`money`) FROM `yeshi_ec_extract` t
|
| | | WHERE FROM_UNIXTIME(t.`extractTime`/1000,'%Y-%m-%d') = #{preDay} |
| | | </select>
|
| | |
|
| | | <select id="countExtractApplyNumber" resultMap="ChartMap">
|
| | | SELECT COUNT(t.id) AS showValue,
|
| | | <if test="type == 1">
|
| | | FROM_UNIXTIME(t.`extractTime`/1000,'%Y-%m-%d') AS
|
| | | 'showDate'
|
| | | </if>
|
| | | <if test="type == 2">
|
| | | FROM_UNIXTIME(t.`extractTime`/1000,'%m') AS 'showDate'
|
| | | </if>
|
| | | <if test="type == 3">
|
| | | FROM_UNIXTIME(t.`extractTime`/1000,'%Y') AS 'showDate'
|
| | | </if>
|
| | | FROM `yeshi_ec_extract` t
|
| | | WHERE t.`extractTime` IS NOT NULL
|
| | | <if test="startTime != null and startTime != '' ">
|
| | | AND FROM_UNIXTIME(t.`extractTime`/1000,'%Y-%m-%d')<![CDATA[ >= ]]>'${startTime}'
|
| | | </if>
|
| | | <if test="endTime != null and endTime != '' ">
|
| | | AND FROM_UNIXTIME(t.`extractTime`/1000,'%Y-%m-%d') <![CDATA[ <= ]]>
|
| | | '${endTime}'
|
| | | </if>
|
| | | <if test="years != null and years != '' ">
|
| | | AND FROM_UNIXTIME(t.`extractTime`/1000,'%Y') = '${years}'
|
| | | </if>
|
| | | <if test="state != null">
|
| | | AND t.`state` = ${state}
|
| | | </if>
|
| | | <if test="type == 1">
|
| | | GROUP BY FROM_UNIXTIME(t.`extractTime`/1000,'%Y-%m-%d')
|
| | | </if>
|
| | | <if test="type == 2">
|
| | | GROUP BY FROM_UNIXTIME(t.`extractTime`/1000,'%Y-%m')
|
| | | </if>
|
| | | <if test="type == 3">
|
| | | GROUP BY FROM_UNIXTIME(t.`extractTime`/1000,'%Y')
|
| | | </if>
|
| | | ORDER BY t.`extractTime`
|
| | | <select id="countApplyNumberByDay" resultType="Integer">
|
| | | SELECT IFNULL(COUNT(t.id),0) FROM `yeshi_ec_extract` t
|
| | | WHERE FROM_UNIXTIME(t.`extractTime`/1000,'%Y-%m-%d') = #{preDay} |
| | | </select>
|
| | |
|
| | | </mapper>
|
| | |
| | | <result column="goldCoin" property="goldCoin" jdbcType="INTEGER" />
|
| | | </resultMap>
|
| | |
|
| | | <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.bus.user.UserInfo">
|
| | | <id column="id" property="id" jdbcType="BIGINT" />
|
| | | <result column="identifycode" property="openid" jdbcType="VARCHAR" />
|
| | | <result column="login_type" property="loginType" jdbcType="INTEGER" />
|
| | | <result column="wx_open_id" property="wxOpenId" jdbcType="VARCHAR" />
|
| | | <result column="wx_union_id" property="wxUnionId" jdbcType="VARCHAR" />
|
| | | <result column="nick_name" property="nickName" jdbcType="VARCHAR" />
|
| | | <result column="tbName" property="tbName" jdbcType="VARCHAR" />
|
| | | <result column="tbPic" property="tbPic" jdbcType="VARCHAR" />
|
| | | <result column="wxName" property="wxName" jdbcType="VARCHAR" />
|
| | | <result column="wxPic" property="wxPic" jdbcType="VARCHAR" />
|
| | | <result column="portrait" property="portrait" jdbcType="VARCHAR" />
|
| | | <result column="createtime" property="createtime" jdbcType="BIGINT" />
|
| | | <result column="last_logintime" property="lastLoginTime"
|
| | | jdbcType="BIGINT" />
|
| | | <result column="loginip" property="lastLoginIp" jdbcType="VARCHAR" />
|
| | | <result column="type" property="type" jdbcType="INTEGER" />
|
| | | <result column="appid" property="appId" jdbcType="VARCHAR" />
|
| | | <result column="my_hongBao" property="myHongBao" jdbcType="DECIMAL" />
|
| | | <result column="pay_password" property="payPassword" jdbcType="VARCHAR" />
|
| | | <result column="rank" property="rank" jdbcType="INTEGER" />
|
| | | <result column="phone" property="phone" jdbcType="VARCHAR" />
|
| | | <result column="state" property="state" jdbcType="INTEGER" />
|
| | | <result column="state_desc" property="stateDesc" jdbcType="VARCHAR" />
|
| | | </resultMap>
|
| | | |
| | |
|
| | | <select id="listByUserGoldCoin" resultMap="UserGoldCoinMapVO">
|
| | | SELECT IFNULL(SUM(d.`td_money`),0) AS goldCoin,u.`id`,u.`nick_name`,u.`portrait`
|
| | |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
| | |
|
| | | <mapper namespace="com.yeshi.fanli.dao.mybatis.activity.ActivityUserMapper">
|
| | | <resultMap id="BaseResultMap"
|
| | | type="com.yeshi.fanli.entity.bus.activity.ActivityUser">
|
| | | <id column="au_id" property="id" jdbcType="BIGINT" />
|
| | | <result column="au_nick_name" property="nickName" jdbcType="VARCHAR" />
|
| | | <result column="au_portrait" property="portrait" jdbcType="VARCHAR" />
|
| | | <result column="au_create_time" property="createTime" jdbcType="TIMESTAMP" />
|
| | | </resultMap>
|
| | | <sql id="Base_Column_List">au_id,au_nick_name,au_portrait,au_create_time</sql>
|
| | | <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.bus.activity.ActivityUser">
|
| | | <id column="au_id" property="id" jdbcType="BIGINT"/>
|
| | | <result column="au_nick_name" property="nickName" jdbcType="VARCHAR"/>
|
| | | <result column="au_portrait" property="portrait" jdbcType="VARCHAR"/>
|
| | | <result column="au_create_time" property="createTime" jdbcType="TIMESTAMP"/>
|
| | | <result column="au_tag" property="tag" jdbcType="VARCHAR"/>
|
| | | </resultMap>
|
| | | <sql id="Base_Column_List">au_id,au_nick_name,au_portrait,au_create_time,au_tag</sql>
|
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap"
|
| | | parameterType="java.lang.Long">
|
| | | select
|
| | |
| | |
|
| | |
|
| | |
|
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from
|
| | | yeshi_ec_activity_user where au_id = #{id,jdbcType=BIGINT}
|
| | | </delete>
|
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.activity.ActivityUser"
|
| | | useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_activity_user
|
| | | (au_id,au_nick_name,au_portrait,au_create_time) values
|
| | | (#{id,jdbcType=BIGINT},#{nickName,jdbcType=VARCHAR},#{portrait,jdbcType=VARCHAR},#{createTime,jdbcType=TIMESTAMP})
|
| | | </insert>
|
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.activity.ActivityUser"
|
| | | useGeneratedKeys="true" keyProperty="id">
|
| | | insert into yeshi_ec_activity_user
|
| | | <trim prefix="(" suffix=")" suffixOverrides=",">
|
| | | <if test="id != null">au_id,</if>
|
| | | <if test="nickName != null">au_nick_name,</if>
|
| | | <if test="portrait != null">au_portrait,</if>
|
| | | <if test="createTime != null">au_create_time,</if>
|
| | | </trim>
|
| | | values
|
| | | <trim prefix="(" suffix=")" suffixOverrides=",">
|
| | | <if test="id != null">#{id,jdbcType=BIGINT},</if>
|
| | | <if test="nickName != null">#{nickName,jdbcType=VARCHAR},</if>
|
| | | <if test="portrait != null">#{portrait,jdbcType=VARCHAR},</if>
|
| | | <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
|
| | | </trim>
|
| | | </insert>
|
| | | <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.activity.ActivityUser">update
|
| | | yeshi_ec_activity_user set au_nick_name =
|
| | | #{nickName,jdbcType=VARCHAR},au_portrait =
|
| | | #{portrait,jdbcType=VARCHAR},au_create_time =
|
| | | #{createTime,jdbcType=TIMESTAMP} where au_id = #{id,jdbcType=BIGINT}
|
| | | </update>
|
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.activity.ActivityUser">
|
| | | update yeshi_ec_activity_user
|
| | | <set>
|
| | | <if test="nickName != null">au_nick_name=#{nickName,jdbcType=VARCHAR},</if>
|
| | | <if test="portrait != null">au_portrait=#{portrait,jdbcType=VARCHAR},</if>
|
| | | <if test="createTime != null">au_create_time=#{createTime,jdbcType=TIMESTAMP},</if>
|
| | | </set>
|
| | | where au_id = #{id,jdbcType=BIGINT}
|
| | | </update>
|
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.activity.ActivityUser" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_activity_user (au_id,au_nick_name,au_portrait,au_create_time,au_tag) values (#{id,jdbcType=BIGINT},#{nickName,jdbcType=VARCHAR},#{portrait,jdbcType=VARCHAR},#{createTime,jdbcType=TIMESTAMP},#{tag,jdbcType=VARCHAR})</insert>
|
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.activity.ActivityUser" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_activity_user
|
| | | <trim prefix="(" suffix=")" suffixOverrides=",">
|
| | | <if test="id != null">au_id,</if>
|
| | | <if test="nickName != null">au_nick_name,</if>
|
| | | <if test="portrait != null">au_portrait,</if>
|
| | | <if test="createTime != null">au_create_time,</if>
|
| | | <if test="tag != null">au_tag,</if>
|
| | | </trim>values
|
| | | <trim prefix="(" suffix=")" suffixOverrides=",">
|
| | | <if test="id != null">#{id,jdbcType=BIGINT},</if>
|
| | | <if test="nickName != null">#{nickName,jdbcType=VARCHAR},</if>
|
| | | <if test="portrait != null">#{portrait,jdbcType=VARCHAR},</if>
|
| | | <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
|
| | | <if test="tag != null">#{tag,jdbcType=VARCHAR},</if>
|
| | | </trim>
|
| | | </insert>
|
| | | <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.activity.ActivityUser">update yeshi_ec_activity_user set au_nick_name = #{nickName,jdbcType=VARCHAR},au_portrait = #{portrait,jdbcType=VARCHAR},au_create_time = #{createTime,jdbcType=TIMESTAMP},au_tag = #{tag,jdbcType=VARCHAR} where au_id = #{id,jdbcType=BIGINT}</update>
|
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.activity.ActivityUser">update yeshi_ec_activity_user
|
| | | <set>
|
| | | <if test="nickName != null">au_nick_name=#{nickName,jdbcType=VARCHAR},</if>
|
| | | <if test="portrait != null">au_portrait=#{portrait,jdbcType=VARCHAR},</if>
|
| | | <if test="createTime != null">au_create_time=#{createTime,jdbcType=TIMESTAMP},</if>
|
| | | <if test="tag != null">au_tag=#{tag,jdbcType=VARCHAR},</if>
|
| | | </set> where au_id = #{id,jdbcType=BIGINT}
|
| | | </update>
|
| | | </mapper>
|
| | |
| | | </foreach>
|
| | | </if>
|
| | | </select>
|
| | |
|
| | |
|
| | | |
| | | |
| | | <select id="countOrderByTypeAndDate" resultType="Integer">
|
| | | SELECT COUNT(co.`co_id`) FROM yeshi_ec_hongbao_order ho |
| | | LEFT JOIN (SELECT * FROM yeshi_ec_hongbao_v2 v2 |
| | | WHERE 1=1
|
| | | <if test="orderType == 1"> <!-- 自购订单 -->
|
| | | AND (v2.hb_type =1 or v2.hb_type =2)
|
| | | </if>
|
| | | <if test="orderType == 2"> <!-- 分享订单 -->
|
| | | AND v2.`hb_type` = 20
|
| | | </if>
|
| | | <if test="orderType == 3"> <!-- 邀请订单 -->
|
| | | AND v2.`hb_type` = 6
|
| | | </if>
|
| | | )hb ON IF(hb.hb_pid IS NULL,hb.hb_id,hb.hb_pid)=ho.`ho_hongbao_id`
|
| | | LEFT JOIN yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id`
|
| | | WHERE hb.hb_id IS NOT NULL AND (co.`co_state`=1 OR co.`co_state`=2) |
| | | AND DATE_FORMAT(co.`co_third_create_time`,'%Y-%m-%d') = #{preDay}
|
| | | GROUP BY co.`co_order_no`, co.`co_source_type`
|
| | | </select>
|
| | | |
| | | </mapper>
|
| | |
| | | </sql>
|
| | |
|
| | |
|
| | | <select id="countOrderNumber" resultMap="ChartMap">
|
| | | SELECT IFNULL(COUNT(`joi_id`),0) AS showValue,
|
| | | <include refid="Column_DateType" />
|
| | | FROM `yeshi_ec_jd_order_item` left join yeshi_ec_jd_order on jo_order_id=joi_order_id WHERE jo_order_time IS NOT NULL and joi_valid_code!=2
|
| | | <include refid="Count_Select_DateType" />
|
| | | <include refid="Count_Group_DateType" />
|
| | | ORDER BY jo_order_time
|
| | | <select id="countOrderByDay" resultType="Long">
|
| | | SELECT COUNT(`joi_id`) FROM `yeshi_ec_jd_order_item` |
| | | left join yeshi_ec_jd_order on jo_order_id=joi_order_id |
| | | WHERE joi_valid_code!=2 AND FROM_UNIXTIME(jo_order_time/1000,'%Y-%m-%d')=#{preDay}
|
| | | </select>
|
| | |
|
| | | </mapper>
|
| | |
| | | <result column="showValue" property="showValue" jdbcType="VARCHAR" />
|
| | | </resultMap>
|
| | |
|
| | |
|
| | | <resultMap id="CountOrderMap" type="com.yeshi.fanli.dto.order.CountOrderDTO">
|
| | | <result column="uid" property="uid" jdbcType="BIGINT" />
|
| | | <result column="totalOrder" property="totalOrder" jdbcType="INTEGER" />
|
| | | <result column="commission" property="commission" jdbcType="DECIMAL" />
|
| | | </resultMap>
|
| | | |
| | | <sql id="Column_DateType">
|
| | | <if test="dateType == 1">
|
| | | DATE_FORMAT(t.`co_third_create_time`,'%Y-%m-%d') AS 'showDate'
|
| | |
| | | </if>
|
| | | </select>
|
| | |
|
| | | <select id="countOrderNumber" resultMap="ChartMap">
|
| | | SELECT IFNULL(COUNT(t.`co_id`),0) AS showValue,<include refid="Column_DateType"/>
|
| | | FROM `yeshi_ec_common_order` t |
| | | WHERE t.co_source_type=#{sourceType} and t.`co_third_create_time` IS NOT NULL <include refid="Count_Select_DateType"/> |
| | | <include refid="Count_Group_DateType"/>
|
| | | ORDER BY t.`co_third_create_time`
|
| | | <select id="countOrderBySourceTypeAndDay" resultType="java.lang.Long">
|
| | | SELECT COUNT(t.`co_id`) FROM `yeshi_ec_common_order` t |
| | | WHERE t.co_source_type=#{sourceType} AND DATE_FORMAT(t.`co_third_create_time`,'%Y-%m-%d') = #{preDay}
|
| | | </select>
|
| | |
|
| | |
|
| | |
| | | ) b WHERE b.c>=#{minSameGoodsOrderCount}
|
| | | </select>
|
| | |
|
| | | <select id="countOderByUidAndDate" resultType="Integer">
|
| | | SELECT COUNT(1) FROM (SELECT d.`co_id` FROM `yeshi_ec_common_order` d
|
| | | WHERE d.`co_third_create_time`<![CDATA[<=]]> #{preDay} AND d.`co_uid` = #{uid} |
| | | AND (d.`co_state`=1 OR d.`co_state`=2) |
| | | GROUP BY d.`co_order_no`,d.`co_source_type`)A
|
| | | </select>
|
| | |
|
| | | <select id="countValidOrderByDay" resultMap="CountOrderMap">
|
| | | SELECT co_uid AS uid ,totalOrder FROM (
|
| | | SELECT COUNT(d.`co_id`) AS totalOrder,d.`co_uid` FROM `yeshi_ec_common_order` d
|
| | | WHERE DATE_FORMAT(d.`co_third_create_time`,'%Y-%m-%d') = '2019-11-11' AND (d.`co_state`=1 OR d.`co_state`=2) |
| | | GROUP BY d.`co_order_no`,d.`co_source_type`)A
|
| | | GROUP BY co_uid
|
| | | </select>
|
| | | |
| | | <select id="countDownOrderUserByUidAndDate" resultType="Integer">
|
| | | SELECT COUNT(DISTINCT d.`co_uid`) FROM `yeshi_ec_common_order` d
|
| | | WHERE d.`co_third_create_time`<![CDATA[<=]]> #{preDay} AND (d.`co_state`=1 OR d.`co_state`=2) |
| | | <foreach collection="list" item="uid" open="AND (" separator="OR" close=")" >
|
| | | d.`co_uid` = #{uid} |
| | | </foreach>
|
| | | </select>
|
| | | |
| | | <select id="countCommissionByDay" resultMap="CountOrderMap">
|
| | | SELECT co_uid AS uid ,commission FROM (
|
| | | SELECT SUM(IFNULL(d.`co_eIncome`,d.`co_estimate`)) AS commission,d.`co_uid` FROM `yeshi_ec_common_order` d
|
| | | WHERE DATE_FORMAT(d.`co_third_create_time`,'%Y-%m-%d') = '2019-11-11' AND (d.`co_state`=1 OR d.`co_state`=2) |
| | | GROUP BY d.`co_order_no`,d.`co_source_type`)A
|
| | | GROUP BY co_uid
|
| | | </select>
|
| | | |
| | | <select id="countOderByDate" resultType="Integer">
|
| | | SELECT COUNT(1) FROM (SELECT d.`co_id` FROM `yeshi_ec_common_order` d
|
| | | WHERE DATE_FORMAT(d.`co_third_create_time`,'%Y-%m-%d') = #{preDay} AND (d.`co_state`=1 OR d.`co_state`=2) |
| | | GROUP BY d.`co_order_no`,d.`co_source_type`)A
|
| | | </select>
|
| | | |
| | | |
| | | <select id="countCommissionByDate" resultType="BigDecimal">
|
| | | SELECT SUM(IFNULL(d.`co_eIncome`,d.`co_estimate`)) FROM `yeshi_ec_common_order` d
|
| | | WHERE d.`co_third_create_time`= #{preDay} AND (d.`co_state`=1 OR d.`co_state`=2) |
| | | </select>
|
| | |
|
| | | </mapper>
|
| | |
| | | <if test="handleType != null and handleType != 0">AND (d.state = 1 or d.state = 2)</if>
|
| | | <if test="type != null">AND d.type = #{type}</if>
|
| | | </select>
|
| | | <select id="countLostNum" resultMap="ChartMap">
|
| | | SELECT COUNT(t.`id`) AS showValue,
|
| | | <if test="dateType == 1">FROM_UNIXTIME(t.`createTime`/1000,'%Y-%m-%d') AS
|
| | | 'showDate'
|
| | | </if>
|
| | | <if test="dateType == 2">FROM_UNIXTIME(t.`createTime`/1000,'%m') AS 'showDate'</if>
|
| | | <if test="dateType == 3">FROM_UNIXTIME(t.`createTime`/1000,'%Y') AS 'showDate'</if>
|
| | | FROM `yeshi_ec_lost_order` t WHERE t.`createTime`IS NOT NULL
|
| | | <if test="startTime != null and startTime != '' ">
|
| | | AND FROM_UNIXTIME(t.`createTime`/1000,'%Y-%m-%d')<![CDATA[ >= ]]>'${startTime}'
|
| | | </if>
|
| | | <if test="endTime != null and endTime != '' ">
|
| | | AND FROM_UNIXTIME(t.`createTime`/1000,'%Y-%m-%d') <![CDATA[ <= ]]>
|
| | | '${endTime}'
|
| | | </if>
|
| | | <if test="year != null and year != '' ">AND FROM_UNIXTIME(t.`createTime`/1000,'%Y') = '${year}'
|
| | | </if>
|
| | | <if test="resultCode != null and resultCode != 0 ">AND t.`result_code` = ${resultCode}</if>
|
| | | <if test="dateType == 1">GROUP BY FROM_UNIXTIME(t.`createTime`/1000,'%Y-%m-%d')
|
| | | </if>
|
| | | <if test="dateType == 2">GROUP BY FROM_UNIXTIME(t.`createTime`/1000,'%Y-%m')</if>
|
| | | <if test="dateType == 3">GROUP BY FROM_UNIXTIME(t.`createTime`/1000,'%Y')</if>
|
| | | ORDER BY t.`createTime`
|
| | | |
| | | <select id="countLostOrderNum" resultType="Integer">
|
| | | SELECT COUNT(1) FROM (SELECT COUNT(t.`id`) FROM `yeshi_ec_lost_order` t |
| | | WHERE FROM_UNIXTIME(t.`createTime`/1000,'%Y-%m-%d') = #{preDay}
|
| | | GROUP BY t.`orderId`,t.`orderType`)A
|
| | | </select>
|
| | | <select id="countAppealMoney" resultMap="ChartMap">
|
| | | SELECT CAST(SUM(v.`hb_money`)AS DECIMAL(19,2)) AS showValue,
|
| | | <if test="dateType == 1">FROM_UNIXTIME(t.`createTime`/1000,'%Y-%m-%d') AS
|
| | | 'showDate'
|
| | | </if>
|
| | | <if test="dateType == 2">FROM_UNIXTIME(t.`createTime`/1000,'%m') AS 'showDate'</if>
|
| | | <if test="dateType == 3">FROM_UNIXTIME(t.`createTime`/1000,'%Y') AS 'showDate'</if>
|
| | | FROM `yeshi_ec_lost_order` t LEFT JOIN `yeshi_ec_common_order` tc ON
|
| | | tc.`co_order_no` = t.`orderId` LEFT JOIN `yeshi_ec_hongbao_order` h ON
|
| | | h.`ho_order_id` = tc.`co_id` LEFT JOIN `yeshi_ec_hongbao_v2`v ON
|
| | | h.`ho_hongbao_id` = v.`hb_id` WHERE t.`createTime`IS NOT NULL AND
|
| | | t.`result_code` = 2 AND (v.`hb_type` =1 OR v.`hb_type` = 2)
|
| | | <if test="startTime != null and startTime != '' ">
|
| | | AND FROM_UNIXTIME(t.`createTime`/1000,'%Y-%m-%d')<![CDATA[ >= ]]>'${startTime}'
|
| | | </if>
|
| | | <if test="endTime != null and endTime != '' ">
|
| | | AND FROM_UNIXTIME(t.`createTime`/1000,'%Y-%m-%d') <![CDATA[ <= ]]>
|
| | | '${endTime}'
|
| | | </if>
|
| | | <if test="year != null and year != '' ">AND FROM_UNIXTIME(t.`createTime`/1000,'%Y') = '${year}'
|
| | | </if>
|
| | | <if test="dateType == 1">GROUP BY FROM_UNIXTIME(t.`createTime`/1000,'%Y-%m-%d')
|
| | | </if>
|
| | | <if test="dateType == 2">GROUP BY FROM_UNIXTIME(t.`createTime`/1000,'%Y-%m')</if>
|
| | | <if test="dateType == 3">GROUP BY FROM_UNIXTIME(t.`createTime`/1000,'%Y')</if>
|
| | | ORDER BY t.`createTime`
|
| | | |
| | | <select id="countAppealMoney" resultType="BigDecimal">
|
| | | SELECT SUM(IFNULL(co.`co_eIncome`,co.`co_estimate`)) FROM `yeshi_ec_lost_order` t |
| | | LEFT JOIN yeshi_ec_common_order co ON (co.`co_order_no` = t.`orderId` AND co.`co_source_type` = t.`orderType`)
|
| | | WHERE FROM_UNIXTIME(t.`createTime`/1000,'%Y-%m-%d') = #{preDay} AND (co.`co_state`=1 OR co.`co_state`=2) |
| | | </select>
|
| | |
|
| | |
|
| | |
|
| | | <select id="listByMaxHandleTimeAndStateAndResultCode" resultMap="BaseResultMap">
|
| | |
| | | </set> |
| | | where wr_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | |
| | | |
| | | <select id="countWeiQaunOrderNumberByDate" resultType="Integer"> |
| | | SELECT COUNT(1) FROM (SELECT co.`co_id` FROM `yeshi_ec_user_order_weiquan_record` w |
| | | LEFT JOIN `yeshi_ec_common_order` co ON (w.`wr_trade_id` = co.`co_trade_id` AND w.`wr_source_type` = co.`co_source_type`) |
| | | WHERE DATE_FORMAT(w.`wr_create_time`,'%Y-%m-%d') = #{preDay} |
| | | GROUP BY co.`co_order_no`,co.`co_source_type`)A |
| | | </select> |
| | | |
| | | <select id="countWeiQaunOrderMoneyByDate" resultType="BigDecimal"> |
| | | SELECT SUM(w.`wr_money`) FROM `yeshi_ec_user_order_weiquan_record` w |
| | | WHERE DATE_FORMAT(w.`wr_create_time`,'%Y-%m-%d') = #{preDay} |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | <if test="dateType == 3">GROUP BY FROM_UNIXTIME(po_order_create_time,'%Y')</if>
|
| | | </sql>
|
| | |
|
| | |
|
| | |
|
| | | <select id="countOrderNumber" resultMap="ChartMap">
|
| | | SELECT IFNULL(COUNT(`po_id`),0) AS showValue,
|
| | | <include refid="Column_DateType" />
|
| | | FROM `yeshi_ec_pdd_order` t WHERE po_order_create_time IS NOT NULL
|
| | | <include refid="Count_Select_DateType" />
|
| | | <include refid="Count_Group_DateType" />
|
| | | ORDER BY po_order_create_time
|
| | | <select id="countOrderByDay" resultType="Long">
|
| | | SELECT COUNT(`po_id`) FROM `yeshi_ec_pdd_order`
|
| | | WHERE FROM_UNIXTIME(po_order_create_time,'%Y-%m-%d') = #{preDay}
|
| | | </select>
|
| | |
|
| | |
|
| | |
| | | <if test="dateType == 2">GROUP BY DATE_FORMAT(t.`to_create_time`,'%Y-%m')</if>
|
| | | <if test="dateType == 3">GROUP BY DATE_FORMAT(t.`to_create_time`,'%Y')</if>
|
| | | </sql>
|
| | | <select id="countOrderNumber" resultMap="ChartMap">
|
| | | SELECT IFNULL(COUNT(t.`to_id`),0) AS showValue,
|
| | | <include refid="Column_DateType" />
|
| | | FROM `yeshi_ec_taobao_order` t WHERE t.`to_create_time` IS NOT NULL
|
| | | <include refid="Count_Select_DateType" />
|
| | | <include refid="Count_Group_DateType" />
|
| | | ORDER BY t.`to_create_time`
|
| | | |
| | | <select id="countOrderByDay" resultType="Long">
|
| | | SELECT COUNT(t.`to_id`) FROM `yeshi_ec_taobao_order` t
|
| | | WHERE DATE_FORMAT(t.`to_create_time`,'%Y-%m-%d') = #{preDay}
|
| | | </select>
|
| | | </mapper>
|
| | |
| | | <include refid="Count_Group_DateType" />
|
| | | ORDER BY t.`tmo_weiquan_time`
|
| | | </select>
|
| | | |
| | | |
| | | </mapper>
|
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | |
| | | <mapper namespace="com.yeshi.fanli.dao.mybatis.user.UserInfoRegisterMapper"> |
| | | <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.bus.user.UserInfoRegister"> |
| | | <id column="regt_id" property="id" jdbcType="BIGINT"/> |
| | | <result column="regt_channel" property="channel" typeHandler="com.yeshi.fanli.util.mybatishandler.ChannelEnumHandler"/> |
| | | <result column="regt_ip" property="ip" jdbcType="VARCHAR"/> |
| | | <result column="regt_device" property="device" jdbcType="VARCHAR"/> |
| | | <result column="regt_create_time" property="createTime" jdbcType="TIMESTAMP"/> |
| | | </resultMap> |
| | | <sql id="Base_Column_List">regt_id,regt_channel,regt_ip,regt_device,regt_create_time</sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select |
| | | <include refid="Base_Column_List"/>from yeshi_ec_user_info_register where regt_id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_user_info_register where regt_id = #{id,jdbcType=BIGINT}</delete> |
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.user.UserInfoRegister" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_user_info_register (regt_id,regt_channel,regt_ip,regt_device,regt_create_time) values (#{id,jdbcType=BIGINT},#{channel,jdbcType=VARCHAR},#{ip,jdbcType=VARCHAR},#{device,jdbcType=VARCHAR},#{createTime,jdbcType=TIMESTAMP})</insert> |
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.user.UserInfoRegister" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_user_info_register |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">regt_id,</if> |
| | | <if test="channel != null">regt_channel,</if> |
| | | <if test="ip != null">regt_ip,</if> |
| | | <if test="device != null">regt_device,</if> |
| | | <if test="createTime != null">regt_create_time,</if> |
| | | </trim>values |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">#{id,jdbcType=BIGINT},</if> |
| | | <if test="channel != null">#{channel,jdbcType=VARCHAR},</if> |
| | | <if test="ip != null">#{ip,jdbcType=VARCHAR},</if> |
| | | <if test="device != null">#{device,jdbcType=VARCHAR},</if> |
| | | <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.user.UserInfoRegister">update yeshi_ec_user_info_register set regt_channel = #{channel,jdbcType=VARCHAR},regt_ip = #{ip,jdbcType=VARCHAR},regt_device = #{device,jdbcType=VARCHAR},regt_create_time = #{createTime,jdbcType=TIMESTAMP} where regt_id = #{id,jdbcType=BIGINT}</update> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.user.UserInfoRegister">update yeshi_ec_user_info_register |
| | | <set> |
| | | <if test="channel != null">regt_channel=#{channel,jdbcType=VARCHAR},</if> |
| | | <if test="ip != null">regt_ip=#{ip,jdbcType=VARCHAR},</if> |
| | | <if test="device != null">regt_device=#{device,jdbcType=VARCHAR},</if> |
| | | <if test="createTime != null">regt_create_time=#{createTime,jdbcType=TIMESTAMP},</if> |
| | | </set> where regt_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | |
| | | <select id="listByMultipleUids" resultMap="BaseResultMap"> |
| | | SELECT * FROM yeshi_ec_user_info_register d |
| | | WHERE d.`regt_id` IN |
| | | <foreach collection="list" item="id" open="(" separator="," close=")" > |
| | | #{id} |
| | | </foreach> |
| | | </select> |
| | | |
| | | <select id="listByMultipleUidAndDay" resultMap="BaseResultMap"> |
| | | SELECT * FROM yeshi_ec_user_info_register d |
| | | WHERE TO_DAYS(regt_create_time) = #{preDay} AND d.`regt_id` IN |
| | | <foreach collection="list" item="id" open="(" separator="," close=")" > |
| | | #{id} |
| | | </foreach> |
| | | </select> |
| | | |
| | | |
| | | <select id="listUidByChannel" resultType="Long"> |
| | | SELECT regt_id FROM yeshi_ec_user_info_register |
| | | WHERE regt_channel = #{channel} |
| | | </select> |
| | | |
| | | <select id="listUidByChannelAndDay" resultType="Long"> |
| | | SELECT regt_id FROM yeshi_ec_user_info_register |
| | | WHERE regt_channel = #{channel} AND TO_DAYS(regt_create_time) = #{preDay} |
| | | </select> |
| | | |
| | | <select id="listByChannelAndDay" resultMap="BaseResultMap"> |
| | | SELECT * FROM yeshi_ec_user_info_register |
| | | WHERE regt_channel = #{channel} AND TO_DAYS(regt_create_time) = #{preDay} |
| | | </select> |
| | | |
| | | |
| | | <select id="countByChannelAndDay" resultMap="BaseResultMap"> |
| | | SELECT COUNT(regt_id) FROM yeshi_ec_user_info_register |
| | | WHERE regt_channel = #{channel} AND TO_DAYS(regt_create_time) = #{preDay} |
| | | </select> |
| | | |
| | | |
| | | </mapper> |
| | |
| | | package com.yeshi.fanli.service.impl.activity;
|
| | |
|
| | | import java.io.InputStream;
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | | import java.util.UUID;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Service;
|
| | | import org.springframework.web.multipart.MultipartFile;
|
| | | import org.yeshi.utils.tencentcloud.COSManager;
|
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.activity.ActivityRuleUserMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.activity.ActivityUserMapper;
|
| | | import com.yeshi.fanli.entity.bus.activity.ActivityRuleUser;
|
| | | import com.yeshi.fanli.entity.bus.activity.ActivityUser;
|
| | | import com.yeshi.fanli.exception.dynamic.ActivityUserException;
|
| | | import com.yeshi.fanli.service.inter.activity.ActivityUserService;
|
| | | import com.yeshi.fanli.util.FilePathEnum;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | |
|
| | | @Service
|
| | | public class ActivityUserServiceImpl implements ActivityUserService {
|
| | |
| | | activityRuleUserMapper.updateByPrimaryKeySelective(update);
|
| | | }
|
| | | }
|
| | | |
| | | |
| | | @Override
|
| | | public ActivityUser getActivityUserByNickName(ActivityUser record, MultipartFile file) throws ActivityUserException{
|
| | | if (record == null || StringUtil.isNullOrEmpty(record.getNickName()))
|
| | | throw new ActivityUserException(1, "昵称不能为空");
|
| | | try {
|
| | | ActivityUser userExist = activityUserMapper.selectByName(record.getNickName().trim());
|
| | | if (userExist != null) {
|
| | | return userExist;
|
| | | }
|
| | | |
| | | // 不存在则新增
|
| | | if (file == null) {
|
| | | throw new ActivityUserException(1, "头像不能为空");
|
| | | }
|
| | | String portrait = uploadPicture(file);
|
| | | record.setPortrait(portrait);
|
| | | record.setCreateTime(new Date());
|
| | | activityUserMapper.insertSelective(record);
|
| | | |
| | | return record;
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | throw new ActivityUserException(1, "用户信息保存异常");
|
| | | }
|
| | | }
|
| | |
|
| | | |
| | | /**
|
| | | * 上传图片
|
| | | * @param file
|
| | | * @return
|
| | | * @throws Exception
|
| | | */
|
| | | public String uploadPicture(MultipartFile file) throws Exception {
|
| | | // 文件解析 |
| | | InputStream inputStream = file.getInputStream();
|
| | | String contentType = file.getContentType();
|
| | | String type = contentType.substring(contentType.indexOf("/") + 1);
|
| | | // 文件路径
|
| | | String filePath= FilePathEnum.activityUser.getPath() +UUID.randomUUID().toString().replace("-", "") + "." + type;
|
| | | // 执行上传
|
| | | String fileLink= COSManager.getInstance().uploadFile(inputStream, filePath).getUrl();
|
| | | |
| | | return fileLink;
|
| | | }
|
| | |
|
| | | |
| | | @Override
|
| | | public List<ActivityRuleUser> listByRuleCode(Integer ruleCode, int page, int pageSize) {
|
| | | return activityRuleUserMapper.listByRuleCode(ruleCode, (page - 1) * pageSize, pageSize);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public ActivityUser selectByName(String nickName) {
|
| | | return activityUserMapper.selectByName(nickName);
|
| | | }
|
| | |
|
| | | |
| | | @Override
|
| | | public long countByRuleCode(Integer ruleCode) {
|
| | | return activityRuleUserMapper.countByRuleCode(ruleCode);
|
| | | }
|
| | |
|
| | | |
| | | @Override
|
| | | public void deleteByRuleUserId(Long id) {
|
| | | ActivityRuleUser user = activityRuleUserMapper.selectByPrimaryKey(id);
|
| | |
| | | package com.yeshi.fanli.service.impl.count;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.text.DecimalFormat;
|
| | | import java.util.ArrayList;
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | |
|
| | |
| | | import com.yeshi.fanli.dao.mybatis.pdd.PDDOrderMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.taobao.TaoBaoOrderMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.taobao.TaoBaoWeiQuanOrderMapper;
|
| | | import com.yeshi.fanli.dao.user.count.CountOrderInfoDao;
|
| | | import com.yeshi.fanli.dao.user.count.CountOrderTrackRateDao;
|
| | | import com.yeshi.fanli.dto.ChartTDO;
|
| | | import com.yeshi.fanli.dto.order.CountOrderDTO;
|
| | | import com.yeshi.fanli.entity.admin.count.CountOrderTrackRate;
|
| | | import com.yeshi.fanli.entity.admin.count.CountOrderTrackRate.OrderTrackRateEnum;
|
| | | import com.yeshi.fanli.service.inter.order.CommonOrderCountService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | |
|
| | | @Service
|
| | | public class CommonOrderCountServiceImpl implements CommonOrderCountService {
|
| | |
| | |
|
| | | @Resource
|
| | | private CommonOrderCountMapper commonOrderCountMapper;
|
| | | |
| | | |
| | | @Resource
|
| | | private CountOrderInfoDao countOrderInfoDao;
|
| | | |
| | | |
| | | @Resource
|
| | | private CountOrderTrackRateDao countOrderTrackRateDao;
|
| | | |
| | |
|
| | | @Override
|
| | | public Long countByState(Integer state) {
|
| | |
| | | return listObject;
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<ChartTDO> getTrackAccuracyRate(Integer dateType, String year, String startTime, String endTime,
|
| | | int sourceType) throws Exception {
|
| | |
|
| | | List<ChartTDO> result_list = null;
|
| | |
|
| | | // 用户订单
|
| | | List<ChartTDO> listTotal = commonOrderCountMapper.countOrderNumber(dateType, year, startTime, endTime,
|
| | | sourceType);
|
| | | if (listTotal == null || listTotal.size() == 0) {
|
| | | return result_list;
|
| | | }
|
| | |
|
| | | // 淘宝联盟
|
| | | List<ChartTDO> type_list = null;
|
| | | switch (sourceType) {
|
| | | case Constant.SOURCE_TYPE_TAOBAO:
|
| | | type_list = taoBaoOrderMapper.countOrderNumber(dateType, year, startTime, endTime);
|
| | | break;
|
| | | case Constant.SOURCE_TYPE_JD:
|
| | | type_list = jdOrderItemMapper.countOrderNumber(dateType, year, startTime, endTime);
|
| | | break;
|
| | | case Constant.SOURCE_TYPE_PDD:
|
| | | type_list = pddOrderMapper.countOrderNumber(dateType, year, startTime, endTime);
|
| | | break;
|
| | | }
|
| | | if (type_list == null || type_list.size() == 0) {
|
| | | return null;
|
| | | }
|
| | |
|
| | | switch (dateType) {
|
| | | case 1: // 按天处理
|
| | | result_list = dayFactory(startTime, endTime, type_list);
|
| | | break;
|
| | | case 2: // 按月处理
|
| | | result_list = monthFactory(type_list);
|
| | | break;
|
| | | case 3:
|
| | | result_list = yearFactory(type_list);
|
| | | break;
|
| | | default:
|
| | | break;
|
| | | }
|
| | |
|
| | | DecimalFormat df = new DecimalFormat("#.00");
|
| | |
|
| | | for (int i = 0; i < result_list.size(); i++) {
|
| | | double proportion = 0;
|
| | | ChartTDO chartTDO = result_list.get(i);
|
| | | String showDate = chartTDO.getShowDate();
|
| | | for (int j = 0; j < listTotal.size(); j++) {
|
| | | ChartTDO innerChartTDO = listTotal.get(j);
|
| | | String innerDate = innerChartTDO.getShowDate();
|
| | | if (innerDate != null && innerDate.toString().equals(showDate.toString())) {
|
| | | String innerValue = innerChartTDO.getShowValue();
|
| | | long innerData = Long.parseLong(innerValue);
|
| | |
|
| | | String showValue = chartTDO.getShowValue();
|
| | | long showData = Long.parseLong(showValue);
|
| | |
|
| | | if (showData > 0) {
|
| | | proportion = innerData / (double) showData;
|
| | | }
|
| | | break; // 结束内部循环
|
| | | }
|
| | | }
|
| | | chartTDO.setShowValue(Double.parseDouble(df.format(proportion * 100)) + "");
|
| | | }
|
| | |
|
| | | return result_list;
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<ChartTDO> countWeiQaunOrderMoney(Integer dateType, String year, String startTime, String endTime)
|
| | |
| | | public List<Long> getSameGoodsOrderByUidAndHongBaoType(List<Integer> typeList, Long uid, int minSameGoodsOrderCount) {
|
| | | return commonOrderCountMapper.getSameGoodsOrderByUidAndHongBaoType(typeList, uid, minSameGoodsOrderCount);
|
| | | }
|
| | | |
| | | |
| | | @Override
|
| | | public Integer countOderByUidAndDate(Date preDay, Long uid) {
|
| | | return commonOrderCountMapper.countOderByUidAndDate(preDay, uid);
|
| | | }
|
| | | |
| | | @Override
|
| | | public List<CountOrderDTO> countValidOrderByDay(String preDay) {
|
| | | return commonOrderCountMapper.countValidOrderByDay(preDay);
|
| | | }
|
| | | |
| | | @Override
|
| | | public Integer countDownOrderUserByUidAndDate(Date preDay, List<Long> list) {
|
| | | return commonOrderCountMapper.countDownOrderUserByUidAndDate(preDay, list);
|
| | | }
|
| | | |
| | | @Override
|
| | | public List<CountOrderDTO> countCommissionByDay(String preDay) {
|
| | | return commonOrderCountMapper.countCommissionByDay(preDay);
|
| | | }
|
| | | |
| | | |
| | | @Override
|
| | | public Integer countOderByDate(String preDay) {
|
| | | return commonOrderCountMapper.countOderByDate(preDay);
|
| | | }
|
| | | |
| | | @Override
|
| | | public BigDecimal countCommissionByDate(String preDay) {
|
| | | return commonOrderCountMapper.countCommissionByDate(preDay);
|
| | | }
|
| | | |
| | | |
| | | |
| | | @Override
|
| | | public List<CountOrderTrackRate> getOrderTrackRate(int type, Date startTime, Date endTime) {
|
| | | |
| | | OrderTrackRateEnum trackRateEnum = null;
|
| | | if (type == 1) {
|
| | | trackRateEnum = OrderTrackRateEnum.taobao;
|
| | | } else if (type == 2) {
|
| | | trackRateEnum = OrderTrackRateEnum.jd;
|
| | | } else if (type == 3) {
|
| | | trackRateEnum = OrderTrackRateEnum.pdd;
|
| | | } else {
|
| | | trackRateEnum = OrderTrackRateEnum.taobao;
|
| | | }
|
| | |
|
| | | // 重新查询统计今日以及空缺
|
| | | initOrderTrackRate(trackRateEnum);
|
| | | |
| | | return countOrderTrackRateDao.query(trackRateEnum, startTime, endTime);
|
| | | }
|
| | |
|
| | | // 初始化统计
|
| | | private void initOrderTrackRate(OrderTrackRateEnum trackRateEnum) {
|
| | | try {
|
| | | CountOrderTrackRate lastRecord = countOrderTrackRateDao.getMaxDate(trackRateEnum);
|
| | | Date lastDay = null;
|
| | | if (lastRecord != null && lastRecord.getDay() != null) {
|
| | | lastDay = lastRecord.getDay();
|
| | | }
|
| | |
|
| | | if (lastDay == null) {
|
| | | lastDay = TimeUtil.parse("2018-01-01");
|
| | | }
|
| | |
|
| | | Date today = new Date();
|
| | | int betweenDays = DateUtil.daysBetween2(lastDay, today);
|
| | | if (betweenDays > 0) {
|
| | | for (int i = 0; i <= betweenDays; i++) {
|
| | | addOrderTrackRateCount(DateUtil.plusDay(i, lastDay), trackRateEnum);
|
| | | }
|
| | | } else {
|
| | | // 重新统计昨日
|
| | | addOrderTrackRateCount(DateUtil.reduceDay2(1, lastDay), trackRateEnum);
|
| | | // 重新统计今日
|
| | | addOrderTrackRateCount(TimeUtil.getGernalTime(today.getTime()), trackRateEnum);
|
| | | }
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | |
| | | |
| | | |
| | |
|
| | | private void addOrderTrackRateCount(String preDay, OrderTrackRateEnum trackRateEnum) throws Exception {
|
| | | int value = trackRateEnum.getValue();
|
| | | Long count = commonOrderCountMapper.countOrderBySourceTypeAndDay(preDay,value);
|
| | | if (count == null) {
|
| | | count = 0L;
|
| | | }
|
| | | |
| | | Long total = null;
|
| | | switch (value) {
|
| | | case Constant.SOURCE_TYPE_TAOBAO:
|
| | | total = taoBaoOrderMapper.countOrderByDay(preDay);
|
| | | break;
|
| | | case Constant.SOURCE_TYPE_JD:
|
| | | total = jdOrderItemMapper.countOrderByDay(preDay);
|
| | | break;
|
| | | case Constant.SOURCE_TYPE_PDD:
|
| | | total = pddOrderMapper.countOrderByDay(preDay);
|
| | | break;
|
| | | }
|
| | | |
| | | if(total == null)
|
| | | total = 0L;
|
| | | |
| | | CountOrderTrackRate record = new CountOrderTrackRate();
|
| | | record.setNum(count);
|
| | | record.setTotalNum(total);
|
| | | record.setDay(TimeUtil.parse(preDay));
|
| | | record.setType(trackRateEnum.name());
|
| | | record.setId(StringUtil.Md5(preDay + trackRateEnum.name()));
|
| | | countOrderTrackRateDao.save(record);
|
| | | }
|
| | | |
| | | |
| | | }
|
| | |
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.apache.ibatis.annotations.Param;
|
| | | import org.springframework.stereotype.Service;
|
| | | import org.yeshi.utils.DateUtil;
|
| | |
|
| | |
| | | return hongBaoV2CountMapper.countHongBaoType(dateType, type, year, startTime, endTime);
|
| | | }
|
| | |
|
| | | |
| | | |
| | | @Override
|
| | | public Integer countOrderByTypeAndDate(Integer orderType, String preDay) {
|
| | | return hongBaoV2CountMapper.countOrderByTypeAndDate(orderType, preDay);
|
| | | }
|
| | | |
| | | |
| | | |
| | | @Override
|
| | | public List<ChartTDO> getProportionByType(Integer dateType, Integer type, String year, String startTime,
|
| | | String endTime) throws Exception {
|
| | |
| | | package com.yeshi.fanli.service.impl.count;
|
| | |
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.text.DecimalFormat;
|
| | | import java.util.ArrayList;
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.UserInfoCountMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.UserInfoMapper;
|
| | | import com.yeshi.fanli.dao.user.count.CountOrderInfoDao;
|
| | | import com.yeshi.fanli.dao.user.count.CountUserInfoDao;
|
| | | import com.yeshi.fanli.dto.ChartTDO;
|
| | | import com.yeshi.fanli.dto.order.CountOrderDTO;
|
| | | import com.yeshi.fanli.entity.admin.count.CountOrderInfo;
|
| | | import com.yeshi.fanli.entity.admin.count.CountOrderInfo.CountOrderEnum;
|
| | | import com.yeshi.fanli.entity.admin.count.CountUserInfo;
|
| | | import com.yeshi.fanli.entity.admin.count.CountUserInfo.CountUserEnum;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfoRegister;
|
| | | import com.yeshi.fanli.entity.system.ChannelEnum;
|
| | | import com.yeshi.fanli.service.inter.count.HongBaoV2CountService;
|
| | | import com.yeshi.fanli.service.inter.count.UserInfoCountService;
|
| | | import com.yeshi.fanli.service.inter.order.CommonOrderCountService;
|
| | | import com.yeshi.fanli.service.inter.order.LostOrderService;
|
| | | import com.yeshi.fanli.service.inter.order.UserOrderWeiQuanRecordService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoRegisterService;
|
| | | import com.yeshi.fanli.util.MoneyBigDecimalUtil;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | | import com.yeshi.fanli.vo.user.UserGoldCoinVO;
|
| | |
|
| | | @Service
|
| | |
| | |
|
| | | @Resource
|
| | | private UserInfoMapper userInfoMapper;
|
| | | |
| | |
|
| | | @Resource
|
| | | private UserInfoCountMapper userInfoCountMapper;
|
| | |
|
| | | @Resource
|
| | | private CountUserInfoDao countUserInfoDao;
|
| | |
|
| | | @Resource
|
| | | private CountOrderInfoDao countOrderInfoDao;
|
| | |
|
| | | @Resource
|
| | | private CommonOrderCountService commonOrderCountService;
|
| | | |
| | | @Resource
|
| | | private HongBaoV2CountService hongBaoV2CountService;
|
| | |
|
| | | @Resource
|
| | | private UserOrderWeiQuanRecordService userOrderWeiQuanRecordService;
|
| | | |
| | | @Resource
|
| | | private LostOrderService lostOrderService;
|
| | | |
| | | @Resource
|
| | | private UserInfoRegisterService userInfoRegisterService;
|
| | | |
| | | |
| | | |
| | | |
| | | @Override
|
| | | public long countNewUser(Integer isToday, Integer isMonth) {
|
| | | return userInfoMapper.countNewUser(isToday, isMonth);
|
| | | }
|
| | | |
| | |
|
| | | @Override
|
| | | public long countRank(Integer rank) {
|
| | | return userInfoMapper.countRank(rank);
|
| | | }
|
| | | |
| | |
|
| | | @Override
|
| | | public BigDecimal countAllMoney(Double rank) {
|
| | | return userInfoMapper.countAllMoney(rank);
|
| | | }
|
| | | |
| | |
|
| | | @Override
|
| | | public long countLoseUser(int daysNum) {
|
| | |
| | | public long countHasOrderUser() {
|
| | | return userInfoMapper.countHasOrderUser();
|
| | | }
|
| | | |
| | |
|
| | | @Override
|
| | | public List<ChartTDO> countNewUserByDate(String channel,Integer type,String years, String startTime, |
| | | public List<ChartTDO> countNewUserByDate(String channel, Integer type, String years, String startTime,
|
| | | String endTime) throws Exception {
|
| | | return userInfoMapper.countNewUserByDate(channel, type, years, startTime, endTime);
|
| | | |
| | |
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<ChartTDO> getTodayBuyRate(String channel, Integer dateType,String years, String startTime, |
| | | public List<ChartTDO> getTodayBuyRate(String channel, Integer dateType, String years, String startTime,
|
| | | String endTime) throws Exception {
|
| | | |
| | |
|
| | | List<ChartTDO> result_list = null;
|
| | | |
| | | List<ChartTDO> listToday = |
| | | userInfoMapper.getTodayHasOrder(channel, dateType, years, startTime, endTime);
|
| | | |
| | |
|
| | | List<ChartTDO> listToday = userInfoMapper.getTodayHasOrder(channel, dateType, years, startTime, endTime);
|
| | |
|
| | | if (listToday == null || listToday.size() == 0) {
|
| | | return result_list;
|
| | | } |
| | | |
| | | }
|
| | |
|
| | | List<ChartTDO> listTotal = userInfoMapper.countNewUserByDate(channel, dateType, years, startTime, endTime);
|
| | | |
| | |
|
| | | if (listTotal == null || listTotal.size() == 0) {
|
| | | return result_list;
|
| | | }
|
| | | |
| | | switch (dateType){
|
| | | case 1: // 按天处理
|
| | | result_list = dayFactory(startTime, endTime, listTotal);
|
| | | break;
|
| | | case 2: // 按月处理
|
| | | result_list = monthFactory(listTotal);
|
| | | break;
|
| | | case 3: |
| | | result_list = yearFactory(listTotal);
|
| | | break;
|
| | | default: |
| | | break;
|
| | |
|
| | | switch (dateType) {
|
| | | case 1: // 按天处理
|
| | | result_list = dayFactory(startTime, endTime, listTotal);
|
| | | break;
|
| | | case 2: // 按月处理
|
| | | result_list = monthFactory(listTotal);
|
| | | break;
|
| | | case 3:
|
| | | result_list = yearFactory(listTotal);
|
| | | break;
|
| | | default:
|
| | | break;
|
| | | }
|
| | | |
| | |
|
| | | DecimalFormat df = new DecimalFormat("#.00");
|
| | | |
| | |
|
| | | for (int i = 0; i < result_list.size(); i++) {
|
| | | double proportion = 0;
|
| | | ChartTDO chartTDO = result_list.get(i);
|
| | | String showDate = chartTDO.getShowDate();
|
| | | for (int j = 0; j < listToday.size(); j++) {
|
| | | ChartTDO innerTDO = listToday.get(j);
|
| | | ChartTDO innerTDO = listToday.get(j);
|
| | | String innerDate = innerTDO.getShowDate();
|
| | | if (innerDate != null && innerDate.equals(showDate)) {
|
| | | String innerValue = innerTDO.getShowValue();
|
| | | long innerData = Long.parseLong(innerValue);
|
| | | |
| | |
|
| | | String showValue = chartTDO.getShowValue();
|
| | | long showData = Long.parseLong(showValue);
|
| | | |
| | |
|
| | | if (showData > 0) {
|
| | | proportion = innerData/(double)showData;
|
| | | proportion = innerData / (double) showData;
|
| | | }
|
| | | break; // 结束内部循环
|
| | | }
|
| | | }
|
| | | chartTDO.setShowValue(Double.parseDouble(df.format(proportion *100)) + "");
|
| | | chartTDO.setShowValue(Double.parseDouble(df.format(proportion * 100)) + "");
|
| | | }
|
| | | return result_list;
|
| | | }
|
| | | |
| | | |
| | |
|
| | | @Override
|
| | | public List<Object> getWeekBuyRate(String channel, String startTime, String endTime,
|
| | | Integer orderNum, List<String> dateList) throws Exception {
|
| | | public List<Object> getWeekBuyRate(String channel, String startTime, String endTime, Integer orderNum,
|
| | | List<String> dateList) throws Exception {
|
| | | List<Object> resultList = new ArrayList<Object>();
|
| | | if (dateList == null || dateList.size() == 0) {
|
| | | return resultList;
|
| | |
| | |
|
| | | return resultList;
|
| | | }
|
| | | |
| | |
|
| | | public List<ChartTDO> dayFactory(String startTime, String endTime, List<ChartTDO> list) throws Exception {
|
| | | List<ChartTDO> listObject = new ArrayList<ChartTDO>();
|
| | |
| | | plusDay = DateUtil.plusDay(i, startTime);
|
| | | }
|
| | |
|
| | | |
| | | String total = null;
|
| | | for (int j = 0; j < list.size(); j++) {
|
| | | ChartTDO chartTDO = list.get(j);
|
| | |
| | | for (int i = 1; i <= 12; i++) {
|
| | | String total = null;
|
| | | for (int j = 0; j < list.size(); j++) {
|
| | | ChartTDO chartTDO = list.get(j);
|
| | | ChartTDO chartTDO = list.get(j);
|
| | | String month = chartTDO.getShowDate();
|
| | | if ((i + "").equalsIgnoreCase(month) || i == Integer.parseInt(month)) {
|
| | | total = chartTDO.getShowValue();
|
| | |
| | | if (total == null) {
|
| | | total = "0";
|
| | | }
|
| | | |
| | |
|
| | | ChartTDO chartTDO = new ChartTDO();
|
| | | chartTDO.setShowValue(total);
|
| | | |
| | | if (i <10) {
|
| | | chartTDO.setShowDate( "0"+ i);
|
| | |
|
| | | if (i < 10) {
|
| | | chartTDO.setShowDate("0" + i);
|
| | | } else {
|
| | | chartTDO.setShowDate( ""+ i);
|
| | | chartTDO.setShowDate("" + i);
|
| | | }
|
| | | listObject.add(chartTDO);
|
| | | }
|
| | |
| | | public long countByUserGoldCoin(int type, String key) {
|
| | | return userInfoCountMapper.countByUserGoldCoin(type, key);
|
| | | }
|
| | | |
| | | |
| | |
|
| | | @Override
|
| | | public List<UserGoldCoinVO> listByHasGoldCoin(long start, int count, String key) {
|
| | | return userInfoCountMapper.listByHasGoldCoin(start, count, key);
|
| | |
| | | public long countByHasGoldCoin(String key) {
|
| | | return userInfoCountMapper.countByHasGoldCoin(key);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<CountUserInfo> getNewUserData(Date startTime, Date endTime, String channel) {
|
| | | // 重新查询统计今日以及空缺
|
| | | initChannelUserCount();
|
| | |
|
| | | return countUserInfoDao.query(CountUserEnum.newUser, startTime, endTime, channel);
|
| | | }
|
| | |
|
| | | // 初始化统计
|
| | | @Override
|
| | | public void initChannelUserCount() {
|
| | | CountUserInfo lastRecord = countUserInfoDao.getMaxDate(CountUserEnum.newUser);
|
| | | Date lastDay = null;
|
| | | if (lastRecord != null && lastRecord.getDay() != null) {
|
| | | lastDay = lastRecord.getDay();
|
| | | }
|
| | | try {
|
| | | if (lastDay == null) {
|
| | | lastDay = TimeUtil.parse("2017-05-14");
|
| | | }
|
| | |
|
| | | Date today = new Date();
|
| | | int betweenDays = DateUtil.daysBetween2(lastDay, today);
|
| | | // 统计今日之前的
|
| | | if (betweenDays > 0) {
|
| | | for (int i = 0; i <= betweenDays; i++) {
|
| | | addRecordCount(DateUtil.plusDay(i, lastDay));
|
| | | }
|
| | | }
|
| | | // 重新统计今日
|
| | | addRecordCount(TimeUtil.getGernalTime(today.getTime()));
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | private void addRecordCount(String preDay) throws Exception {
|
| | | ChannelEnum[] channels = ChannelEnum.values();
|
| | | for (int i = 0; i < channels.length; i++) {
|
| | | Integer count = userInfoRegisterService.countByChannelAndDay(channels[i].getVlaue(), preDay);
|
| | | if (count == null) {
|
| | | count = 0;
|
| | | }
|
| | | CountUserInfo record = new CountUserInfo();
|
| | | record.setNum(count);
|
| | | record.setChannel(channels[i].name());
|
| | | record.setId(StringUtil.Md5(preDay + channels[i].name() + CountUserEnum.newUser.name()));
|
| | | record.setDay(TimeUtil.parse(preDay));
|
| | | record.setType(CountUserEnum.newUser);
|
| | | countUserInfoDao.save(record);
|
| | | }
|
| | | }
|
| | |
|
| | | |
| | | @Override
|
| | | public List<CountOrderInfo> countOderByChannel(String channel, Date startTime, Date endTime) {
|
| | | // 重新查询统计今日以及空缺
|
| | | initOrderCount();
|
| | |
|
| | | return countOrderInfoDao.query(CountOrderEnum.channelTotal, startTime, endTime, channel);
|
| | | }
|
| | |
|
| | | // 初始化统计
|
| | | private void initOrderCount() {
|
| | | try {
|
| | | CountOrderInfo lastRecord = countOrderInfoDao.getMaxDate(CountOrderEnum.channelTotal);
|
| | | Date lastDay = null;
|
| | | if (lastRecord != null && lastRecord.getDay() != null) {
|
| | | lastDay = lastRecord.getDay();
|
| | | }
|
| | |
|
| | | if (lastDay == null) {
|
| | | lastDay = TimeUtil.parse("2018-01-01");
|
| | | }
|
| | |
|
| | | Date today = new Date();
|
| | | int betweenDays = DateUtil.daysBetween2(lastDay, today);
|
| | | if (betweenDays > 0) {
|
| | | for (int i = 0; i <= betweenDays; i++) {
|
| | | addRecordOrderCount(DateUtil.plusDay(i, lastDay));
|
| | | }
|
| | | } else {
|
| | | // 重新统计昨日
|
| | | addRecordOrderCount(DateUtil.reduceDay2(1, lastDay));
|
| | | // 重新统计今日
|
| | | addRecordOrderCount(TimeUtil.getGernalTime(today.getTime()));
|
| | | }
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | |
| | | |
| | | private void addRecordOrderCount(String preDay) throws Exception {
|
| | | ChannelEnum[] channels = ChannelEnum.values();
|
| | | for (int i = 0; i < channels.length; i++) {
|
| | | int count = 0;
|
| | | String channelVlaue = channels[i].getVlaue();
|
| | | |
| | | List<CountOrderDTO> listOrder = commonOrderCountService.countValidOrderByDay(preDay);
|
| | | if (listOrder != null && listOrder.size() > 0) {
|
| | | List<Long> listUid = new ArrayList<>();
|
| | | for (CountOrderDTO countOrderDTO: listOrder) {
|
| | | listUid.add(countOrderDTO.getUid());
|
| | | }
|
| | | |
| | | List<UserInfoRegister> listRegister = userInfoRegisterService.listByMultipleUids(listUid);
|
| | | if (listRegister != null && listRegister.size() > 0) {
|
| | | for (int m = 0; m <listRegister.size(); m ++) {
|
| | | boolean reduce = false;
|
| | | Long uid = listRegister.get(m).getId();
|
| | | String vlaue = listRegister.get(m).getChannel().getVlaue();
|
| | | |
| | | for (int n = 0; n <listOrder.size(); n ++) {
|
| | | if (channelVlaue.equalsIgnoreCase(vlaue) && uid.longValue() == listOrder.get(n).getUid()) {
|
| | | Integer totalOrder = listOrder.get(n).getTotalOrder();
|
| | | if (totalOrder != null)
|
| | | count += totalOrder;
|
| | | |
| | | listOrder.remove(n);
|
| | | n--;
|
| | | reduce = true;
|
| | | }
|
| | | }
|
| | | |
| | | if (reduce) {
|
| | | listRegister.remove(m);
|
| | | m--;
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | |
| | | CountOrderInfo record = new CountOrderInfo();
|
| | | record.setNum(count);
|
| | | record.setChannel(channels[i].name());
|
| | | record.setDay(TimeUtil.parse(preDay));
|
| | | record.setType(CountOrderEnum.channelTotal.name());
|
| | | record.setId(StringUtil.Md5(preDay + channels[i].name() + CountOrderEnum.channelTotal.name()));
|
| | | countOrderInfoDao.save(record);
|
| | | }
|
| | | }
|
| | | |
| | | |
| | | @Override
|
| | | public List<CountOrderInfo> count24HOderByChannel(String channel, Date startTime, Date endTime) {
|
| | | // 重新查询统计今日以及空缺
|
| | | init24HOrderCount();
|
| | |
|
| | | return countOrderInfoDao.query(CountOrderEnum.oder24H, startTime, endTime, channel);
|
| | | }
|
| | |
|
| | | // 初始化统计
|
| | | private void init24HOrderCount() {
|
| | | try {
|
| | | CountOrderInfo lastRecord = countOrderInfoDao.getMaxDate(CountOrderEnum.oder24H);
|
| | | Date lastDay = null;
|
| | | if (lastRecord != null && lastRecord.getDay() != null) {
|
| | | lastDay = lastRecord.getDay();
|
| | | }
|
| | |
|
| | | if (lastDay == null) {
|
| | | lastDay = TimeUtil.parse("2018-01-01");
|
| | | }
|
| | |
|
| | | Date today = new Date();
|
| | | int betweenDays = DateUtil.daysBetween2(lastDay, today);
|
| | | if (betweenDays > 0) {
|
| | | for (int i = 0; i <= betweenDays; i++) {
|
| | | addRecord24HOrderCount(DateUtil.plusDay(i, lastDay));
|
| | | }
|
| | | } else {
|
| | | // 重新统计昨日
|
| | | addRecord24HOrderCount(DateUtil.reduceDay2(1, lastDay));
|
| | | // 重新统计今日
|
| | | addRecord24HOrderCount(TimeUtil.getGernalTime(today.getTime()));
|
| | | }
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | private void addRecord24HOrderCount(String preDay) throws Exception {
|
| | | ChannelEnum[] channels = ChannelEnum.values();
|
| | | for (int i = 0; i < channels.length; i++) {
|
| | | int count = 0;
|
| | | List<UserInfoRegister> list = userInfoRegisterService.listByChannelAndDay(channels[i].getVlaue(), preDay);
|
| | | if (list != null && list.size() > 0) {
|
| | | // 统计24小时产生订单数量
|
| | | for (UserInfoRegister user : list) {
|
| | | Date limitDay = DateUtil.plusDayDate(1, user.getCreateTime());
|
| | | Integer total = commonOrderCountService.countOderByUidAndDate(limitDay, user.getId());
|
| | | if (total != null)
|
| | | count += total;
|
| | | }
|
| | | }
|
| | | CountOrderInfo record = new CountOrderInfo();
|
| | | record.setNum(count);
|
| | | record.setChannel(channels[i].name());
|
| | | record.setDay(TimeUtil.parse(preDay));
|
| | | record.setType(CountOrderEnum.oder24H.name());
|
| | | record.setId(StringUtil.Md5(preDay + channels[i].name() + CountOrderEnum.oder24H.name()));
|
| | | countOrderInfoDao.save(record);
|
| | | }
|
| | | }
|
| | |
|
| | | |
| | | @Override
|
| | | public List<CountOrderInfo> countHongBaoByChannel(String channel, Date startTime, Date endTime) {
|
| | | // 重新查询统计今日以及空缺
|
| | | initHongBaoCount();
|
| | |
|
| | | return countOrderInfoDao.query(CountOrderEnum.channelCommission, startTime, endTime, channel);
|
| | | }
|
| | |
|
| | | // 初始化统计
|
| | | private void initHongBaoCount() {
|
| | | try {
|
| | | CountOrderInfo lastRecord = countOrderInfoDao.getMaxDate(CountOrderEnum.channelCommission);
|
| | | Date lastDay = null;
|
| | | if (lastRecord != null && lastRecord.getDay() != null) {
|
| | | lastDay = lastRecord.getDay();
|
| | | }
|
| | |
|
| | | if (lastDay == null) {
|
| | | lastDay = TimeUtil.parse("2018-01-01");
|
| | | }
|
| | |
|
| | | Date today = new Date();
|
| | | int betweenDays = DateUtil.daysBetween2(lastDay, today);
|
| | | if (betweenDays > 0) {
|
| | | for (int i = 0; i <= betweenDays; i++) {
|
| | | addRecordHongBaoCount(DateUtil.plusDay(i, lastDay));
|
| | | }
|
| | | } else {
|
| | | // 重新统计昨日
|
| | | addRecordHongBaoCount(DateUtil.reduceDay2(1, lastDay));
|
| | | // 重新统计今日
|
| | | addRecordHongBaoCount(TimeUtil.getGernalTime(today.getTime()));
|
| | | }
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | private void addRecordHongBaoCount(String preDay) throws Exception {
|
| | | ChannelEnum[] channels = ChannelEnum.values();
|
| | | for (int i = 0; i < channels.length; i++) {
|
| | | BigDecimal money = new BigDecimal(0);
|
| | | String channelVlaue = channels[i].getVlaue();
|
| | | |
| | | List<CountOrderDTO> listOrder = commonOrderCountService.countCommissionByDay(preDay);
|
| | | if (listOrder != null && listOrder.size() > 0) {
|
| | | List<Long> listUid = new ArrayList<>();
|
| | | for (CountOrderDTO countOrderDTO: listOrder) {
|
| | | listUid.add(countOrderDTO.getUid());
|
| | | }
|
| | | |
| | | List<UserInfoRegister> listRegister = userInfoRegisterService.listByMultipleUids(listUid);
|
| | | if (listRegister != null && listRegister.size() > 0) {
|
| | | for (int m = 0; m <listRegister.size(); m ++) {
|
| | | boolean reduce = false;
|
| | | Long uid = listRegister.get(m).getId();
|
| | | String vlaue = listRegister.get(m).getChannel().getVlaue();
|
| | | |
| | | for (int n = 0; n <listOrder.size(); n ++) {
|
| | | if (channelVlaue.equalsIgnoreCase(vlaue) && uid.longValue() == listOrder.get(n).getUid()) {
|
| | | BigDecimal commission = listOrder.get(n).getCommission();
|
| | | if (commission != null)
|
| | | MoneyBigDecimalUtil.add(money, commission);
|
| | | |
| | | listOrder.remove(n);
|
| | | n--;
|
| | | reduce = true;
|
| | | }
|
| | | }
|
| | | |
| | | if (reduce) {
|
| | | listRegister.remove(m);
|
| | | m--;
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | |
| | | |
| | | CountOrderInfo record = new CountOrderInfo();
|
| | | record.setMoney(money);
|
| | | record.setChannel(channels[i].name());
|
| | | record.setDay(TimeUtil.parse(preDay));
|
| | | record.setType(CountOrderEnum.channelCommission.name());
|
| | | record.setId(StringUtil.Md5(preDay + channels[i].name() + CountOrderEnum.channelCommission.name()));
|
| | | countOrderInfoDao.save(record);
|
| | | }
|
| | | }
|
| | | |
| | | |
| | | @Override
|
| | | public List<CountOrderInfo> countWeiQuanOrder(Date startTime, Date endTime) {
|
| | | // 重新查询统计今日以及空缺
|
| | | initWeiQuanCount();
|
| | |
|
| | | return countOrderInfoDao.query(CountOrderEnum.weiQuanNum, startTime, endTime);
|
| | | }
|
| | |
|
| | | // 初始化统计
|
| | | private void initWeiQuanCount() {
|
| | | try {
|
| | | CountOrderInfo lastRecord = countOrderInfoDao.getMaxDate(CountOrderEnum.weiQuanNum);
|
| | | Date lastDay = null;
|
| | | if (lastRecord != null && lastRecord.getDay() != null) {
|
| | | lastDay = lastRecord.getDay();
|
| | | }
|
| | |
|
| | | if (lastDay == null) {
|
| | | lastDay = TimeUtil.parse("2019-01-01");
|
| | | }
|
| | |
|
| | | Date today = new Date();
|
| | | int betweenDays = DateUtil.daysBetween2(lastDay, today);
|
| | | if (betweenDays > 0) {
|
| | | for (int i = 0; i <= betweenDays; i++) {
|
| | | addRecordWeiQuanCount(DateUtil.plusDay(i, lastDay));
|
| | | }
|
| | | } else {
|
| | | // 重新统计昨日
|
| | | addRecordWeiQuanCount(DateUtil.reduceDay2(1, lastDay));
|
| | | // 重新统计今日
|
| | | addRecordWeiQuanCount(TimeUtil.getGernalTime(today.getTime()));
|
| | | }
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | private void addRecordWeiQuanCount(String preDay) throws Exception {
|
| | | Integer count = userOrderWeiQuanRecordService.countWeiQaunOrderNumberByDate(preDay);
|
| | | if (count == null)
|
| | | count = 0;
|
| | | CountOrderInfo record = new CountOrderInfo();
|
| | | record.setNum(count);
|
| | | record.setDay(TimeUtil.parse(preDay));
|
| | | record.setType(CountOrderEnum.weiQuanNum.name());
|
| | | record.setId(StringUtil.Md5(preDay + CountOrderEnum.weiQuanNum.name()));
|
| | | countOrderInfoDao.save(record);
|
| | | }
|
| | | |
| | | |
| | | @Override
|
| | | public List<CountOrderInfo> countWeiQuanOrderMoney(Date startTime, Date endTime) {
|
| | | // 重新查询统计今日以及空缺
|
| | | initWeiQuanMoneyCount();
|
| | |
|
| | | return countOrderInfoDao.query(CountOrderEnum.weiQuanMoney, startTime, endTime);
|
| | | }
|
| | |
|
| | | // 初始化统计
|
| | | private void initWeiQuanMoneyCount() {
|
| | | try {
|
| | | CountOrderInfo lastRecord = countOrderInfoDao.getMaxDate(CountOrderEnum.weiQuanMoney);
|
| | | Date lastDay = null;
|
| | | if (lastRecord != null && lastRecord.getDay() != null) {
|
| | | lastDay = lastRecord.getDay();
|
| | | }
|
| | |
|
| | | if (lastDay == null) {
|
| | | lastDay = TimeUtil.parse("2019-01-01");
|
| | | }
|
| | |
|
| | | Date today = new Date();
|
| | | int betweenDays = DateUtil.daysBetween2(lastDay, today);
|
| | | if (betweenDays > 0) {
|
| | | for (int i = 0; i <= betweenDays; i++) {
|
| | | addRecordWeiQuanMoneyCount(DateUtil.plusDay(i, lastDay));
|
| | | }
|
| | | } else {
|
| | | // 重新统计昨日
|
| | | addRecordWeiQuanMoneyCount(DateUtil.reduceDay2(1, lastDay));
|
| | | // 重新统计今日
|
| | | addRecordWeiQuanMoneyCount(TimeUtil.getGernalTime(today.getTime()));
|
| | | }
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | private void addRecordWeiQuanMoneyCount(String preDay) throws Exception {
|
| | | BigDecimal money = userOrderWeiQuanRecordService.countWeiQaunOrderMoneyByDate(preDay);
|
| | | if (money == null)
|
| | | money = new BigDecimal(0);
|
| | | CountOrderInfo record = new CountOrderInfo();
|
| | | record.setMoney(money);
|
| | | record.setDay(TimeUtil.parse(preDay));
|
| | | record.setType(CountOrderEnum.weiQuanMoney.name());
|
| | | record.setId(StringUtil.Md5(preDay + CountOrderEnum.weiQuanMoney.name()));
|
| | | countOrderInfoDao.save(record);
|
| | | }
|
| | | |
| | | |
| | | @Override
|
| | | public List<CountOrderInfo> counOrderTotalNum(Date startTime, Date endTime) {
|
| | | // 重新查询统计今日以及空缺
|
| | | initOrderTotalNum();
|
| | |
|
| | | return countOrderInfoDao.query(CountOrderEnum.totalNum, startTime, endTime);
|
| | | }
|
| | |
|
| | | // 初始化统计
|
| | | private void initOrderTotalNum() {
|
| | | try {
|
| | | CountOrderInfo lastRecord = countOrderInfoDao.getMaxDate(CountOrderEnum.totalNum);
|
| | | Date lastDay = null;
|
| | | if (lastRecord != null && lastRecord.getDay() != null) {
|
| | | lastDay = lastRecord.getDay();
|
| | | }
|
| | |
|
| | | if (lastDay == null) {
|
| | | lastDay = TimeUtil.parse("2019-01-01");
|
| | | }
|
| | |
|
| | | Date today = new Date();
|
| | | int betweenDays = DateUtil.daysBetween2(lastDay, today);
|
| | | if (betweenDays > 0) {
|
| | | for (int i = 0; i <= betweenDays; i++) {
|
| | | addRecordOrderTotalNum(DateUtil.plusDay(i, lastDay));
|
| | | }
|
| | | } else {
|
| | | // 重新统计昨日
|
| | | addRecordOrderTotalNum(DateUtil.reduceDay2(1, lastDay));
|
| | | // 重新统计今日
|
| | | addRecordOrderTotalNum(TimeUtil.getGernalTime(today.getTime()));
|
| | | }
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | private void addRecordOrderTotalNum(String preDay) throws Exception {
|
| | | Integer num = commonOrderCountService.countOderByDate(preDay);
|
| | | if (num == null)
|
| | | num = 0;
|
| | | CountOrderInfo record = new CountOrderInfo();
|
| | | record.setNum(num);
|
| | | record.setDay(TimeUtil.parse(preDay));
|
| | | record.setType(CountOrderEnum.totalNum.name());
|
| | | record.setId(StringUtil.Md5(preDay + CountOrderEnum.totalNum.name()));
|
| | | countOrderInfoDao.save(record);
|
| | | }
|
| | | |
| | | |
| | | |
| | | |
| | | @Override
|
| | | public List<CountOrderInfo> counOrderTotalCommission(Date startTime, Date endTime) {
|
| | | // 重新查询统计今日以及空缺
|
| | | initTotalCommission();
|
| | |
|
| | | return countOrderInfoDao.query(CountOrderEnum.totalCommission, startTime, endTime);
|
| | | }
|
| | |
|
| | | // 初始化统计
|
| | | private void initTotalCommission() {
|
| | | try {
|
| | | CountOrderInfo lastRecord = countOrderInfoDao.getMaxDate(CountOrderEnum.totalCommission);
|
| | | Date lastDay = null;
|
| | | if (lastRecord != null && lastRecord.getDay() != null) {
|
| | | lastDay = lastRecord.getDay();
|
| | | }
|
| | |
|
| | | if (lastDay == null) {
|
| | | lastDay = TimeUtil.parse("2019-01-01");
|
| | | }
|
| | |
|
| | | Date today = new Date();
|
| | | int betweenDays = DateUtil.daysBetween2(lastDay, today);
|
| | | if (betweenDays > 0) {
|
| | | for (int i = 0; i <= betweenDays; i++) {
|
| | | addRecordTotalCommission(DateUtil.plusDay(i, lastDay));
|
| | | }
|
| | | } else {
|
| | | // 重新统计昨日
|
| | | addRecordTotalCommission(DateUtil.reduceDay2(1, lastDay));
|
| | | // 重新统计今日
|
| | | addRecordTotalCommission(TimeUtil.getGernalTime(today.getTime()));
|
| | | }
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | private void addRecordTotalCommission(String preDay) throws Exception {
|
| | | BigDecimal money = commonOrderCountService.countCommissionByDate(preDay);
|
| | | if (money == null)
|
| | | money = new BigDecimal("0");
|
| | | CountOrderInfo record = new CountOrderInfo();
|
| | | record.setMoney(money);
|
| | | record.setDay(TimeUtil.parse(preDay));
|
| | | record.setType(CountOrderEnum.totalCommission.name());
|
| | | record.setId(StringUtil.Md5(preDay + CountOrderEnum.totalCommission.name()));
|
| | | countOrderInfoDao.save(record);
|
| | | }
|
| | | |
| | | @Override
|
| | | public List<CountOrderInfo> counOrderLastNum(Date startTime, Date endTime) {
|
| | | // 重新查询统计今日以及空缺
|
| | | initOrderLastNum();
|
| | |
|
| | | return countOrderInfoDao.query(CountOrderEnum.lastNum, startTime, endTime);
|
| | | }
|
| | |
|
| | | // 初始化统计
|
| | | private void initOrderLastNum() {
|
| | | try {
|
| | | CountOrderInfo lastRecord = countOrderInfoDao.getMaxDate(CountOrderEnum.lastNum);
|
| | | Date lastDay = null;
|
| | | if (lastRecord != null && lastRecord.getDay() != null) {
|
| | | lastDay = lastRecord.getDay();
|
| | | }
|
| | |
|
| | | if (lastDay == null) {
|
| | | lastDay = TimeUtil.parse("2019-01-01");
|
| | | }
|
| | |
|
| | | Date today = new Date();
|
| | | int betweenDays = DateUtil.daysBetween2(lastDay, today);
|
| | | if (betweenDays > 0) {
|
| | | for (int i = 0; i <= betweenDays; i++) {
|
| | | addRecordOrderLastNum(DateUtil.plusDay(i, lastDay));
|
| | | }
|
| | | } else {
|
| | | // 重新统计昨日
|
| | | addRecordOrderLastNum(DateUtil.reduceDay2(1, lastDay));
|
| | | // 重新统计今日
|
| | | addRecordOrderLastNum(TimeUtil.getGernalTime(today.getTime()));
|
| | | }
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | private void addRecordOrderLastNum(String preDay) throws Exception {
|
| | | Integer num = lostOrderService.countLostOrderNum(preDay);
|
| | | if (num == null)
|
| | | num = 0;
|
| | | CountOrderInfo record = new CountOrderInfo();
|
| | | record.setNum(num);
|
| | | record.setDay(TimeUtil.parse(preDay));
|
| | | record.setType(CountOrderEnum.lastNum.name());
|
| | | record.setId(StringUtil.Md5(preDay + CountOrderEnum.lastNum.name()));
|
| | | countOrderInfoDao.save(record);
|
| | | }
|
| | | |
| | | @Override
|
| | | public List<CountOrderInfo> counOrderLastMoney(Date startTime, Date endTime) {
|
| | | // 重新查询统计今日以及空缺
|
| | | initOrderLastMoney();
|
| | |
|
| | | return countOrderInfoDao.query(CountOrderEnum.lastMoney, startTime, endTime);
|
| | | }
|
| | |
|
| | | // 初始化统计
|
| | | private void initOrderLastMoney() {
|
| | | try {
|
| | | CountOrderInfo lastRecord = countOrderInfoDao.getMaxDate(CountOrderEnum.lastMoney);
|
| | | Date lastDay = null;
|
| | | if (lastRecord != null && lastRecord.getDay() != null) {
|
| | | lastDay = lastRecord.getDay();
|
| | | }
|
| | |
|
| | | if (lastDay == null) {
|
| | | lastDay = TimeUtil.parse("2019-01-01");
|
| | | }
|
| | |
|
| | | Date today = new Date();
|
| | | int betweenDays = DateUtil.daysBetween2(lastDay, today);
|
| | | if (betweenDays > 0) {
|
| | | for (int i = 0; i <= betweenDays; i++) {
|
| | | addRecordOrderLastMoney(DateUtil.plusDay(i, lastDay));
|
| | | }
|
| | | } else {
|
| | | // 重新统计昨日
|
| | | addRecordOrderLastMoney(DateUtil.reduceDay2(1, lastDay));
|
| | | // 重新统计今日
|
| | | addRecordOrderLastMoney(TimeUtil.getGernalTime(today.getTime()));
|
| | | }
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | private void addRecordOrderLastMoney(String preDay) throws Exception {
|
| | | BigDecimal money = lostOrderService.countAppealMoney(preDay);
|
| | | if (money == null)
|
| | | money = new BigDecimal("0");
|
| | | CountOrderInfo record = new CountOrderInfo();
|
| | | record.setMoney(money);
|
| | | record.setDay(TimeUtil.parse(preDay));
|
| | | record.setType(CountOrderEnum.lastMoney.name());
|
| | | record.setId(StringUtil.Md5(preDay + CountOrderEnum.lastMoney.name()));
|
| | | countOrderInfoDao.save(record);
|
| | | }
|
| | | |
| | | |
| | | @Override
|
| | | public List<CountOrderInfo> countOrderType(Integer state, Date startTime, Date endTime) {
|
| | | // 重新查询统计今日以及空缺
|
| | | initOrderTypeCount();
|
| | |
|
| | | return countOrderInfoDao.query(CountOrderEnum.orderType, startTime, endTime, state);
|
| | | }
|
| | |
|
| | | // 初始化统计
|
| | | private void initOrderTypeCount() {
|
| | | try {
|
| | | CountOrderInfo lastRecord = countOrderInfoDao.getMaxDate(CountOrderEnum.orderType);
|
| | | Date lastDay = null;
|
| | | if (lastRecord != null && lastRecord.getDay() != null) {
|
| | | lastDay = lastRecord.getDay();
|
| | | }
|
| | |
|
| | | if (lastDay == null) {
|
| | | lastDay = TimeUtil.parse("2018-01-01");
|
| | | }
|
| | |
|
| | | Date today = new Date();
|
| | | int betweenDays = DateUtil.daysBetween2(lastDay, today);
|
| | | if (betweenDays > 0) {
|
| | | for (int i = 0; i <= betweenDays; i++) {
|
| | | addRecordOrderTypeCount(DateUtil.plusDay(i, lastDay));
|
| | | }
|
| | | } else {
|
| | | // 重新统计昨日
|
| | | addRecordOrderTypeCount(DateUtil.reduceDay2(1, lastDay));
|
| | | // 重新统计今日
|
| | | addRecordOrderTypeCount(TimeUtil.getGernalTime(today.getTime()));
|
| | | }
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | private void addRecordOrderTypeCount(String preDay) throws Exception {
|
| | | for (int i = 1; i < 4; i++) {
|
| | | Integer count = hongBaoV2CountService.countOrderByTypeAndDate(i, preDay);
|
| | | if (count == null)
|
| | | count = 0;
|
| | | CountOrderInfo record = new CountOrderInfo();
|
| | | record.setNum(count);
|
| | | record.setState(i);
|
| | | record.setDay(TimeUtil.parse(preDay));
|
| | | record.setType(CountOrderEnum.orderType.name());
|
| | | record.setId(StringUtil.Md5(preDay + CountOrderEnum.orderType.name()));
|
| | | countOrderInfoDao.save(record);
|
| | | }
|
| | | }
|
| | | |
| | | @Override
|
| | | public List<CountUserInfo> countUserDownOrderByChannelAndToday(String channel, Date startTime, Date endTime) {
|
| | | // 重新查询统计今日以及空缺
|
| | | initTodayDownOrderCount();
|
| | |
|
| | | return countUserInfoDao.query(CountUserEnum.todayOrder, startTime, endTime, channel);
|
| | | }
|
| | |
|
| | | // 初始化统计
|
| | | private void initTodayDownOrderCount() {
|
| | | try {
|
| | | CountUserInfo lastRecord = countUserInfoDao.getMaxDate(CountUserEnum.todayOrder);
|
| | | Date lastDay = null;
|
| | | if (lastRecord != null && lastRecord.getDay() != null) {
|
| | | lastDay = lastRecord.getDay();
|
| | | }
|
| | | if (lastDay == null) {
|
| | | lastDay = TimeUtil.parse("2018-01-01");
|
| | | }
|
| | |
|
| | | Date today = new Date();
|
| | | int betweenDays = DateUtil.daysBetween2(lastDay, today);
|
| | | if (betweenDays > 0) {
|
| | | for (int i = 0; i <= betweenDays; i++) {
|
| | | addRecordTodayDownOrderCount(DateUtil.plusDay(i, lastDay));
|
| | | }
|
| | | } else {
|
| | | // 重新统计昨日
|
| | | addRecordTodayDownOrderCount(DateUtil.reduceDay2(1, lastDay));
|
| | | // 重新统计今日
|
| | | addRecordTodayDownOrderCount(TimeUtil.getGernalTime(today.getTime()));
|
| | | }
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | private void addRecordTodayDownOrderCount(String preDay) throws Exception {
|
| | | ChannelEnum[] channels = ChannelEnum.values();
|
| | | for (int i = 0; i < channels.length; i++) {
|
| | | int count = 0;
|
| | | String channelVlaue = channels[i].getVlaue();
|
| | | |
| | | List<CountOrderDTO> listOrder = commonOrderCountService.countValidOrderByDay(preDay);
|
| | | if (listOrder != null && listOrder.size() > 0) {
|
| | | List<Long> listUid = new ArrayList<>();
|
| | | for (CountOrderDTO countOrderDTO: listOrder) {
|
| | | listUid.add(countOrderDTO.getUid());
|
| | | }
|
| | | |
| | | List<UserInfoRegister> listRegister = userInfoRegisterService.listByMultipleUidAndDay(listUid, preDay);
|
| | | if (listRegister != null && listRegister.size() > 0) {
|
| | | for (int m = 0; m <listRegister.size(); m ++) {
|
| | | boolean reduce = false;
|
| | | Long uid = listRegister.get(m).getId();
|
| | | String vlaue = listRegister.get(m).getChannel().getVlaue();
|
| | | |
| | | for (int n = 0; n <listOrder.size(); n ++) {
|
| | | if (channelVlaue.equalsIgnoreCase(vlaue) && uid.longValue() == listOrder.get(n).getUid()) {
|
| | | Integer totalOrder = listOrder.get(n).getTotalOrder();
|
| | | if (totalOrder != null)
|
| | | count += totalOrder;
|
| | | |
| | | listOrder.remove(n);
|
| | | n--;
|
| | | reduce = true;
|
| | | }
|
| | | }
|
| | | |
| | | if (reduce) {
|
| | | listRegister.remove(m);
|
| | | m--;
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | |
| | | CountUserInfo record = new CountUserInfo();
|
| | | record.setNum(count);
|
| | | record.setChannel(channels[i].name());
|
| | | record.setDay(TimeUtil.parse(preDay));
|
| | | record.setType(CountUserEnum.todayOrder);
|
| | | record.setId(StringUtil.Md5(preDay + channels[i].name() + CountUserEnum.todayOrder.name()));
|
| | | countUserInfoDao.save(record);
|
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<CountUserInfo> countUseByChannelAndWeekOrder(String channel, Date startTime, Date endTime) {
|
| | | return countUserInfoDao.query(CountUserEnum.weekOrder, startTime, endTime, channel);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<CountUserInfo> countUseByChannelAndWeekThreeOrder(String channel, Date startTime, Date endTime) {
|
| | | return countUserInfoDao.query(CountUserEnum.weekThreeOrder, startTime, endTime, channel);
|
| | | }
|
| | |
|
| | | // 初始化统计
|
| | | @Override
|
| | | public void initCountUserWeekOrder() {
|
| | | try {
|
| | | CountUserInfo lastRecord = countUserInfoDao.getMaxDate(CountUserEnum.weekOrder);
|
| | | Date lastDay = null;
|
| | | if (lastRecord != null && lastRecord.getDay() != null) {
|
| | | lastDay = lastRecord.getDay();
|
| | | }
|
| | | if (lastDay == null) {
|
| | | lastDay = TimeUtil.parse("2018-01-01");
|
| | | }
|
| | | Date today = new Date();
|
| | | int betweenDays = DateUtil.daysBetween2(lastDay, today);
|
| | | if (betweenDays > 0) {
|
| | | for (int i = 0; i <= betweenDays; i++) {
|
| | | addRecordWeekOrderCount(DateUtil.plusDay(i, lastDay));
|
| | | }
|
| | | } else {
|
| | | // 重新统计昨日
|
| | | addRecordWeekOrderCount(DateUtil.reduceDay2(1, lastDay));
|
| | | // 重新统计今日
|
| | | addRecordWeekOrderCount(TimeUtil.getGernalTime(today.getTime()));
|
| | | }
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | private void addRecordWeekOrderCount(String preDay) throws Exception {
|
| | | ChannelEnum[] channels = ChannelEnum.values();
|
| | | for (int i = 0; i < channels.length; i++) {
|
| | | int count = 0;
|
| | | int count3 = 0;
|
| | | List<UserInfoRegister> list = userInfoRegisterService.listByChannelAndDay(channels[i].getVlaue(), preDay);
|
| | | if (list != null && list.size() > 0) {
|
| | | Date startDay = new Date(TimeUtil.convertDateToTemp2(preDay + " 23:59:59"));
|
| | | Date limitDay = DateUtil.plusDayDate(6, startDay);
|
| | | for (UserInfoRegister user : list) {
|
| | | Integer total = commonOrderCountService.countOderByUidAndDate(limitDay, user.getId());
|
| | | if (total != null && total > 0) {
|
| | | count++;
|
| | | if (total >= 3) {
|
| | | count3++;
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | // 7天内产生有效订单
|
| | | CountUserInfo record = new CountUserInfo();
|
| | | record.setNum(count);
|
| | | record.setChannel(channels[i].name());
|
| | | record.setDay(TimeUtil.parse(preDay));
|
| | | record.setType(CountUserEnum.weekOrder);
|
| | | record.setId(StringUtil.Md5(preDay + channels[i].name() + CountUserEnum.weekOrder.name()));
|
| | | countUserInfoDao.save(record);
|
| | |
|
| | | // 7天内产生3单以上有效订单
|
| | | CountUserInfo record3 = new CountUserInfo();
|
| | | record3.setNum(count3);
|
| | | record3.setChannel(channels[i].name());
|
| | | record3.setDay(TimeUtil.parse(preDay));
|
| | | record3.setType(CountUserEnum.weekThreeOrder);
|
| | | record3.setId(StringUtil.Md5(preDay + channels[i].name() + CountUserEnum.weekThreeOrder.name()));
|
| | | countUserInfoDao.save(record);
|
| | | }
|
| | | }
|
| | | |
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.service.impl.dynamic; |
| | | |
| | | import java.io.InputStream; |
| | | import java.math.BigDecimal; |
| | | import java.util.ArrayList; |
| | | import java.util.Collections; |
| | | import java.util.Comparator; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.UUID; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import org.springframework.cache.annotation.Cacheable; |
| | | import org.springframework.core.task.TaskExecutor; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | import org.springframework.web.multipart.MultipartHttpServletRequest; |
| | | import org.yeshi.utils.tencentcloud.COSManager; |
| | | |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.reflect.TypeToken; |
| | | import com.yeshi.fanli.dao.dynamic.GoodsEvaluateDao; |
| | | import com.yeshi.fanli.dto.ConfigParamsDTO; |
| | | import com.yeshi.fanli.dto.pdd.PDDGoodsDetail; |
| | | import com.yeshi.fanli.entity.bus.activity.ActivityUser; |
| | | import com.yeshi.fanli.entity.dynamic.CommentInfo; |
| | | import com.yeshi.fanli.entity.dynamic.GoodsEvaluate; |
| | | import com.yeshi.fanli.entity.dynamic.ImgInfo; |
| | | import com.yeshi.fanli.entity.dynamic.ImgInfo.ImgEnum; |
| | | import com.yeshi.fanli.entity.dynamic.SimpleGoods; |
| | | import com.yeshi.fanli.entity.jd.JDGoods; |
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief; |
| | | import com.yeshi.fanli.exception.dynamic.ActivityUserException; |
| | | import com.yeshi.fanli.exception.dynamic.GoodsEvaluateException; |
| | | import com.yeshi.fanli.exception.taobao.TaobaoGoodsDownException; |
| | | import com.yeshi.fanli.log.LogHelper; |
| | | import com.yeshi.fanli.service.inter.activity.ActivityUserService; |
| | | import com.yeshi.fanli.service.inter.dynamic.GoodsEvaluateService; |
| | | import com.yeshi.fanli.service.inter.order.config.HongBaoManageService; |
| | | import com.yeshi.fanli.util.Constant; |
| | | import com.yeshi.fanli.util.FilePathEnum; |
| | | import com.yeshi.fanli.util.RedisManager; |
| | | import com.yeshi.fanli.util.StringUtil; |
| | | import com.yeshi.fanli.util.cache.JDGoodsCacheUtil; |
| | | import com.yeshi.fanli.util.cache.PinDuoDuoCacheUtil; |
| | | import com.yeshi.fanli.util.factory.goods.GoodsDetailVOFactory; |
| | | import com.yeshi.fanli.vo.goods.CouponInfoVO; |
| | | import com.yeshi.fanli.vo.goods.GoodsDetailVO; |
| | | import com.yeshi.fanli.vo.msg.ClientTextStyleVO; |
| | | |
| | | @Service |
| | | public class GoodsEvaluateServiceImpl implements GoodsEvaluateService { |
| | | |
| | | @Resource |
| | | private GoodsEvaluateDao goodsEvaluateDao; |
| | | |
| | | @Resource |
| | | private ActivityUserService activityUserService; |
| | | |
| | | @Resource |
| | | private RedisManager redisManager; |
| | | |
| | | @Resource |
| | | private HongBaoManageService hongBaoManageService; |
| | | |
| | | @Resource(name = "taskExecutor") |
| | | private TaskExecutor executor; |
| | | |
| | | @Resource |
| | | private JDGoodsCacheUtil jdGoodsCacheUtil; |
| | | |
| | | @Resource |
| | | private PinDuoDuoCacheUtil pinDuoDuoCacheUtil; |
| | | |
| | | @Override |
| | | public void saveHead(MultipartFile file, GoodsEvaluate record) throws GoodsEvaluateException { |
| | | Integer state = record.getState(); |
| | | if (state == null) { |
| | | state = 0; |
| | | } |
| | | |
| | | String tilte = record.getTitle(); |
| | | if (StringUtil.isNullOrEmpty(tilte)) { |
| | | throw new GoodsEvaluateException(1, "推荐语不能为空"); |
| | | } |
| | | |
| | | try { |
| | | ActivityUser activityUser = activityUserService.getActivityUserByNickName(record.getUser(), file); |
| | | if (activityUser == null) |
| | | throw new GoodsEvaluateException(1, "请选择发布者"); |
| | | record.setUser(activityUser); |
| | | } catch (ActivityUserException e) { |
| | | throw new GoodsEvaluateException(1, e.getMsg()); |
| | | } |
| | | |
| | | if (record.getEndTime() != null) { |
| | | if (record.getEndTime().getTime() <= java.lang.System.currentTimeMillis()) |
| | | throw new GoodsEvaluateException(1, "截止时间必须大于当前时间"); |
| | | |
| | | if (record.getStartTime() != null && record.getEndTime().getTime() <= record.getStartTime().getTime()) |
| | | throw new GoodsEvaluateException(1, "截止时间必须大于开始时间"); |
| | | } |
| | | |
| | | if (record.getShareNum() == null) |
| | | record.setShareNum(0); |
| | | |
| | | if (record.getWeight() == null) |
| | | record.setWeight(0.0); |
| | | |
| | | if (record.getStartTime() == null) |
| | | record.setStartTime(new Date()); |
| | | record.setPublishTime(record.getStartTime()); |
| | | |
| | | if (StringUtil.isNullOrEmpty(record.getId())) { |
| | | record.setId(UUID.randomUUID().toString().replace("-", "")); |
| | | record.setShareNumReal(0); |
| | | record.setCreateTime(new Date()); |
| | | goodsEvaluateDao.save(record); |
| | | } else { |
| | | GoodsEvaluate resultObj = goodsEvaluateDao.getById(record.getId()); |
| | | if (resultObj == null) |
| | | throw new GoodsEvaluateException(1, "修改内容已不存在"); |
| | | |
| | | resultObj.setUser(record.getUser()); |
| | | resultObj.setShareNum(record.getShareNum()); |
| | | resultObj.setWeight(record.getWeight()); |
| | | resultObj.setStartTime(record.getStartTime()); |
| | | resultObj.setEndTime(record.getEndTime()); |
| | | resultObj.setTitle(tilte); |
| | | goodsEvaluateDao.save(resultObj); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 上传图片 |
| | | * |
| | | * @param file |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | private String uploadPicture(MultipartFile file) throws Exception { |
| | | InputStream inputStream = file.getInputStream(); |
| | | String contentType = file.getContentType(); |
| | | String type = contentType.substring(contentType.indexOf("/") + 1); |
| | | String filePath = FilePathEnum.goodsEvaluate.getPath() + UUID.randomUUID().toString().replace("-", "") + "." |
| | | + type; |
| | | return COSManager.getInstance().uploadFile(inputStream, filePath).getUrl(); |
| | | } |
| | | |
| | | /** |
| | | * 删除图片 |
| | | * |
| | | * @param record |
| | | * @throws Exception |
| | | */ |
| | | private void removePicture(String picture) throws Exception { |
| | | if (picture != null && picture.trim().length() > 0) { |
| | | COSManager.getInstance().deleteFile(picture); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void saveSingleGoods(String pid, Long goodsId, Integer goodsType, String videoUrl, Integer picNum, |
| | | String picUrls, MultipartHttpServletRequest fileRequest) throws GoodsEvaluateException, Exception { |
| | | if (StringUtil.isNullOrEmpty(pid)) { |
| | | throw new GoodsEvaluateException(1, "请保存第一部分信息"); |
| | | } |
| | | |
| | | GoodsEvaluate resultObj = goodsEvaluateDao.getById(pid); |
| | | if (resultObj == null) |
| | | throw new GoodsEvaluateException(1, "第一部分信息缺失"); |
| | | |
| | | // 原封视频面图 |
| | | ImgInfo imgVideo = null; |
| | | List<String> listDel = new ArrayList<String>(); |
| | | List<String> listOld = new ArrayList<String>(); |
| | | |
| | | // 处理图片 |
| | | List<ImgInfo> resultList = resultObj.getImgList(); |
| | | if (resultList != null && resultList.size() > 0) { |
| | | for (ImgInfo info : resultList) { |
| | | ImgEnum type = info.getType(); |
| | | if (type == ImgEnum.video) { |
| | | imgVideo = info; |
| | | } else if (type == ImgEnum.goods || type == ImgEnum.img) { |
| | | String url = info.getUrl(); |
| | | if (!StringUtil.isNullOrEmpty(url)) { |
| | | listOld.add(url); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | // 视频部分 |
| | | if (fileRequest != null) { |
| | | MultipartFile filevideo = fileRequest.getFile("filevideo"); |
| | | if (filevideo != null) { |
| | | if (StringUtil.isNullOrEmpty(videoUrl)) { |
| | | throw new GoodsEvaluateException(1, "视频链接不能为空"); |
| | | } |
| | | |
| | | String picLink = uploadPicture(filevideo); |
| | | if (imgVideo != null) { |
| | | String url = imgVideo.getUrl(); |
| | | if (!StringUtil.isNullOrEmpty(url)) { |
| | | listDel.add(url); |
| | | } |
| | | imgVideo.setUrl(picLink); |
| | | imgVideo.setUrlHD(picLink); |
| | | } else { |
| | | imgVideo = new ImgInfo(); |
| | | imgVideo.setId(UUID.randomUUID().toString().replace("-", "")); |
| | | imgVideo.setW(1); |
| | | imgVideo.setH(1); |
| | | imgVideo.setLarge(true); |
| | | imgVideo.setPid(pid); |
| | | imgVideo.setUrl(picLink); |
| | | imgVideo.setUrlHD(picLink); |
| | | imgVideo.setVideoUrl(videoUrl); |
| | | imgVideo.setType(ImgEnum.video); |
| | | } |
| | | } |
| | | } |
| | | |
| | | List<ImgInfo> listImg = new ArrayList<ImgInfo>(); |
| | | if (imgVideo != null) { |
| | | if (!StringUtil.isNullOrEmpty(videoUrl)) { |
| | | if (imgVideo != null && StringUtil.isNullOrEmpty(imgVideo.getUrl())) { |
| | | throw new GoodsEvaluateException(1, "视频封面图不能为空"); |
| | | } |
| | | imgVideo.setVideoUrl(videoUrl); |
| | | listImg.add(imgVideo); |
| | | } else { |
| | | String url = imgVideo.getUrl(); |
| | | if (!StringUtil.isNullOrEmpty(url)) { |
| | | listDel.add(url); |
| | | } |
| | | } |
| | | } |
| | | |
| | | // 编辑图片 |
| | | List<String> listpic = null; |
| | | if (!StringUtil.isNullOrEmpty(picUrls)) { |
| | | String[] pics = picUrls.split(","); |
| | | if (pics != null) { |
| | | listpic = new ArrayList<>(); |
| | | for (int i = 0; i < pics.length; i++ ) { |
| | | if(pics[i].startsWith("http")){ |
| | | listpic.add(pics[i]); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (fileRequest != null) { |
| | | for (int i = 0; i < 9; i++) { |
| | | MultipartFile file = fileRequest.getFile("file" + i); |
| | | if (file == null) { |
| | | continue; |
| | | } |
| | | // 上传文件 |
| | | String picLink = uploadPicture(file); |
| | | if (listpic != null && listpic.size() > i) { |
| | | // 需要删除的list |
| | | String delUrl = listpic.get(i); |
| | | listDel.add(delUrl); |
| | | listpic.set(i, picLink); |
| | | continue; |
| | | } |
| | | listpic.add(picLink); |
| | | } |
| | | |
| | | // 指定主图 |
| | | if (picNum == null || picNum > 9 || picNum < 1) { |
| | | picNum = 1; |
| | | } |
| | | |
| | | if (listpic != null && listpic.size() > 0) { |
| | | // 对比图片 |
| | | for (int j = 0; j < listOld.size(); j++) { |
| | | boolean del = true; |
| | | for (int i = 0; i < listpic.size(); i++) { |
| | | if (listpic.get(i).equals(listOld.get(j))) { |
| | | del = false; |
| | | break; |
| | | } |
| | | } |
| | | if (del) |
| | | listDel.add(listOld.get(j)); |
| | | } |
| | | |
| | | for (int i = 0; i < listpic.size(); i++) { |
| | | ImgInfo imgInfo0 = new ImgInfo(); |
| | | imgInfo0.setId(UUID.randomUUID().toString().replace("-", "")); |
| | | imgInfo0.setW(1); |
| | | imgInfo0.setH(1); |
| | | imgInfo0.setLarge(false); |
| | | imgInfo0.setPid(pid); |
| | | imgInfo0.setUrl(listpic.get(i)); |
| | | imgInfo0.setUrlHD(listpic.get(i)); |
| | | |
| | | if (picNum - 1 == i) { |
| | | imgInfo0.setType(ImgEnum.goods); |
| | | // 商品信息 |
| | | GoodsDetailVO goodsDetailVO = null; // TODO |
| | | // getGoodsDetailVO(goodsId, goodsType); |
| | | // if (goodsDetailVO == null) { |
| | | // throw new GoodsEvaluateException(1, "该商品信息不存在"); |
| | | // } |
| | | |
| | | SimpleGoods simpleGoods = new SimpleGoods(); |
| | | simpleGoods.setGoodsId(goodsId); |
| | | simpleGoods.setGoodsType(goodsType); |
| | | // simpleGoods.setPrice(goodsDetailVO.getCouponPrice()); |
| | | // CouponInfoVO couponInfo = goodsDetailVO.getCouponInfo(); |
| | | // if (couponInfo == null) { |
| | | // simpleGoods.setState(1); |
| | | // } else { |
| | | // simpleGoods.setAmount(couponInfo.getAmount()); |
| | | // simpleGoods.setState(0); |
| | | // } |
| | | imgInfo0.setGoods(simpleGoods); |
| | | } else { |
| | | imgInfo0.setType(ImgEnum.img); |
| | | } |
| | | listImg.add(imgInfo0); |
| | | } |
| | | } |
| | | } |
| | | |
| | | // 保存图片信息 |
| | | resultObj.setMainPicNum(picNum); |
| | | resultObj.setImgList(listImg); |
| | | goodsEvaluateDao.save(resultObj); |
| | | |
| | | // 删除图片 |
| | | if (listDel.size() > 0) { |
| | | for (String url : listDel) { |
| | | if (url.contains(FilePathEnum.goodsEvaluate.getPath())) { |
| | | removePicture(url); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | public GoodsDetailVO getGoodsDetailVO(Long goodsId, Integer goodsType) throws GoodsEvaluateException { |
| | | GoodsDetailVO goodsDetail = null; |
| | | BigDecimal fanLiRate = hongBaoManageService.getFanLiRate(); |
| | | BigDecimal shareRate = hongBaoManageService.getShareRate(); |
| | | BigDecimal vipFanLiRate = hongBaoManageService.getVIPFanLiRate(); |
| | | ConfigParamsDTO params = new ConfigParamsDTO(fanLiRate, shareRate, Constant.MAX_REWARD_RATE, vipFanLiRate); |
| | | if (goodsType == Constant.SOURCE_TYPE_TAOBAO) { |
| | | try { |
| | | TaoBaoGoodsBrief goodsBrief = redisManager.getTaoBaoGoodsBrief(goodsId); |
| | | goodsDetail = GoodsDetailVOFactory.convertTaoBao(goodsBrief, params); |
| | | } catch (TaobaoGoodsDownException e) { |
| | | throw new GoodsEvaluateException(1, "商品已下架"); |
| | | } |
| | | } else if (goodsType == Constant.SOURCE_TYPE_JD) { |
| | | JDGoods goodsInfo = jdGoodsCacheUtil.getGoodsInfo(goodsId); |
| | | goodsDetail = GoodsDetailVOFactory.convertJDGoods(goodsInfo, params); |
| | | } else if (goodsType == Constant.SOURCE_TYPE_PDD) { |
| | | PDDGoodsDetail goodsInfo = pinDuoDuoCacheUtil.getGoodsInfo(goodsId); |
| | | goodsDetail = GoodsDetailVOFactory.convertPDDGoods(goodsInfo, params); |
| | | } |
| | | return goodsDetail; |
| | | } |
| | | |
| | | @Override |
| | | public void saveSingleGoodsCoupon(String pid, CommentInfo commentInfo) throws GoodsEvaluateException, Exception { |
| | | if (StringUtil.isNullOrEmpty(pid)) { |
| | | throw new GoodsEvaluateException(1, "请保存第一部分信息"); |
| | | } |
| | | |
| | | GoodsEvaluate resultObj = goodsEvaluateDao.getById(pid); |
| | | if (resultObj == null) |
| | | throw new GoodsEvaluateException(1, "第一部分信息缺失"); |
| | | |
| | | List<CommentInfo> comments = new ArrayList<>(); |
| | | if (commentInfo != null) { |
| | | comments.add(commentInfo); |
| | | } |
| | | resultObj.setComments(comments); |
| | | |
| | | goodsEvaluateDao.save(resultObj); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void saveActivityPic(String pid, ImgInfo imgInfo, MultipartHttpServletRequest fileRequest) throws GoodsEvaluateException, Exception { |
| | | if (StringUtil.isNullOrEmpty(pid)) { |
| | | throw new GoodsEvaluateException(1, "请保存第一部分信息"); |
| | | } |
| | | |
| | | GoodsEvaluate resultObj = goodsEvaluateDao.getById(pid); |
| | | if (resultObj == null) |
| | | throw new GoodsEvaluateException(1, "第一部分信息缺失"); |
| | | |
| | | String videoPic = null; |
| | | String activityPic = null; |
| | | ImgInfo imgVideo = null; |
| | | ImgInfo imgactivity = null; |
| | | List<ImgInfo> resultList = resultObj.getImgList(); |
| | | if (resultList != null && resultList.size() > 0) { |
| | | for(ImgInfo info: resultList) { |
| | | if (info.getType() == ImgEnum.activity) { |
| | | activityPic = info.getActivityPic(); |
| | | imgVideo = info; |
| | | } else { |
| | | imgVideo = info; |
| | | videoPic = info.getUrl(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | List<ImgInfo> listImg = new ArrayList<ImgInfo>(); |
| | | if (fileRequest != null) { |
| | | MultipartFile filevideo = fileRequest.getFile("filevideo"); |
| | | if (filevideo != null) { |
| | | removePicture(videoPic); |
| | | String picLink = uploadPicture(filevideo); |
| | | videoPic = picLink; |
| | | } |
| | | |
| | | MultipartFile activityfile = fileRequest.getFile("activityfile"); |
| | | if (activityfile != null) { |
| | | removePicture(activityPic); |
| | | String picLink = uploadPicture(activityfile); |
| | | activityPic = picLink; |
| | | } |
| | | } |
| | | |
| | | if (!StringUtil.isNullOrEmpty(videoPic) || !StringUtil.isNullOrEmpty(imgInfo.getVideoUrl())) { |
| | | if (imgVideo != null){ |
| | | imgVideo.setUrl(videoPic); |
| | | imgVideo.setUrlHD(videoPic); |
| | | imgVideo.setVideoUrl(imgInfo.getVideoUrl()); |
| | | } else { |
| | | imgVideo = new ImgInfo(); |
| | | imgVideo.setId(UUID.randomUUID().toString().replace("-", "")); |
| | | imgVideo.setW(1); |
| | | imgVideo.setH(1); |
| | | imgVideo.setLarge(true); |
| | | imgVideo.setPid(pid); |
| | | imgVideo.setUrl(videoPic); |
| | | imgVideo.setUrlHD(videoPic); |
| | | imgVideo.setVideoUrl(imgInfo.getVideoUrl()); |
| | | imgVideo.setType(ImgEnum.video); |
| | | } |
| | | listImg.add(imgVideo); |
| | | } |
| | | |
| | | if (!StringUtil.isNullOrEmpty(activityPic) || !StringUtil.isNullOrEmpty(imgInfo.getActivityUrl())) { |
| | | if (imgVideo != null){ |
| | | imgVideo.setUrl(activityPic); |
| | | imgVideo.setUrlHD(activityPic); |
| | | imgVideo.setVideoUrl(imgInfo.getVideoUrl()); |
| | | } else { |
| | | imgVideo = new ImgInfo(); |
| | | imgVideo.setId(UUID.randomUUID().toString().replace("-", "")); |
| | | imgVideo.setW(1); |
| | | imgVideo.setH(1); |
| | | imgVideo.setLarge(true); |
| | | imgVideo.setPid(pid); |
| | | imgVideo.setUrl(activityPic); |
| | | imgVideo.setUrlHD(activityPic); |
| | | imgVideo.setActivityUrl(imgInfo.getActivityUrl()); |
| | | imgVideo.setType(ImgEnum.activity); |
| | | } |
| | | listImg.add(imgVideo); |
| | | } |
| | | resultObj.setImgList(listImg); |
| | | goodsEvaluateDao.save(resultObj); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void deleteBatchByPrimaryKey(List<String> list) { |
| | | if (list == null || list.size() == 0) { |
| | | return; |
| | | } |
| | | for (String id : list) { |
| | | goodsEvaluateDao.deleteById(id); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public GoodsEvaluate getById(String id) { |
| | | return goodsEvaluateDao.getById(id); |
| | | } |
| | | |
| | | @Override |
| | | public void saveComment(String pid, CommentInfo commentInfo) throws GoodsEvaluateException { |
| | | GoodsEvaluate goodsEvaluate = goodsEvaluateDao.getById(pid); |
| | | if (goodsEvaluate == null) { |
| | | throw new GoodsEvaluateException(1, "动态已不存在"); |
| | | } |
| | | |
| | | String tags = commentInfo.getTags(); |
| | | if (!StringUtil.isNullOrEmpty(tags)) { |
| | | String[] arrayTags = tags.split("\\s+"); |
| | | if (arrayTags != null && arrayTags.length > 0) { |
| | | String[] arrayTagsColour = null; |
| | | String tagsColour = commentInfo.getTagsColour(); |
| | | if (!StringUtil.isNullOrEmpty(tagsColour)) { |
| | | arrayTagsColour = tagsColour.split("\\s+"); |
| | | } |
| | | |
| | | String color = "#E5005C"; |
| | | List<ClientTextStyleVO> tagList = new ArrayList<ClientTextStyleVO>(); |
| | | for (int i = 0; i < arrayTags.length; i++) { |
| | | String tag = arrayTags[i]; |
| | | if (arrayTagsColour != null && arrayTagsColour.length == arrayTags.length) { |
| | | color = arrayTagsColour[i]; |
| | | } |
| | | ClientTextStyleVO styleVO = new ClientTextStyleVO(); |
| | | styleVO.setColor(color); |
| | | styleVO.setContent(tag); |
| | | tagList.add(styleVO); |
| | | } |
| | | commentInfo.setTagList(tagList); |
| | | } |
| | | } |
| | | |
| | | List<CommentInfo> comments = goodsEvaluate.getComments(); |
| | | if (comments == null) { |
| | | comments = new ArrayList<>(); |
| | | } |
| | | |
| | | Integer weight = commentInfo.getWeight(); |
| | | if (weight == null) |
| | | commentInfo.setWeight(1); |
| | | |
| | | comments.add(commentInfo); |
| | | |
| | | Collections.shuffle(comments); |
| | | Comparator<CommentInfo> cm = new Comparator<CommentInfo>() { |
| | | @Override |
| | | public int compare(CommentInfo o1, CommentInfo o2) { |
| | | return o1.getWeight() != null && o2.getWeight() != null ? o2.getWeight() - o1.getWeight() : 0; |
| | | } |
| | | }; |
| | | Collections.sort(comments, cm); |
| | | |
| | | goodsEvaluate.setComments(comments); |
| | | goodsEvaluateDao.save(goodsEvaluate); |
| | | } |
| | | |
| | | @Override |
| | | public void deleteComment(String pid, List<String> list) throws GoodsEvaluateException { |
| | | if (list == null || list.size() == 0) { |
| | | return; |
| | | } |
| | | GoodsEvaluate goodsEvaluate = goodsEvaluateDao.getById(pid); |
| | | if (goodsEvaluate == null) { |
| | | throw new GoodsEvaluateException(1, "动态已不存在"); |
| | | } |
| | | |
| | | List<CommentInfo> comments = goodsEvaluate.getComments(); |
| | | if (comments == null || comments.size() == 0) { |
| | | return; |
| | | } |
| | | |
| | | for (String id : list) { |
| | | for (int i = 0; i < comments.size(); i++) { |
| | | CommentInfo commentInfo = comments.get(i); |
| | | if (id.equals(commentInfo.getId())) { |
| | | comments.remove(i); |
| | | i--; |
| | | } |
| | | } |
| | | } |
| | | goodsEvaluate.setComments(comments); |
| | | goodsEvaluateDao.save(goodsEvaluate); |
| | | } |
| | | |
| | | @Override |
| | | public void addShareNum(String id) { |
| | | GoodsEvaluate article = goodsEvaluateDao.getById(id); |
| | | if (article != null) { |
| | | Integer num = article.getShareNum(); |
| | | if (num == null) { |
| | | num = 0; |
| | | } |
| | | article.setShareNum(num + 1); |
| | | |
| | | Integer numReal = article.getShareNumReal(); |
| | | if (numReal == null) { |
| | | numReal = 0; |
| | | } |
| | | article.setShareNumReal(numReal + 1); |
| | | |
| | | goodsEvaluateDao.save(article); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public List<GoodsEvaluate> query(int start, int count, String key, Integer state) { |
| | | return goodsEvaluateDao.query(start, count, key, state); |
| | | } |
| | | |
| | | @Override |
| | | public long count(String key, Integer state) { |
| | | return goodsEvaluateDao.count(key, state); |
| | | } |
| | | |
| | | @Override |
| | | @Cacheable(value = "dynamicCache", key = "'queryValidEvaluateCache-'+#start") |
| | | public List<GoodsEvaluate> queryValidEvaluateCache(int start, int count) { |
| | | List<GoodsEvaluate> list = goodsEvaluateDao.queryValid(start, count); |
| | | |
| | | // 更新商品信息 |
| | | executor.execute(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | updateGoodInfo(list); |
| | | } |
| | | }); |
| | | |
| | | return list; |
| | | } |
| | | |
| | | @Override |
| | | public long countValid() { |
| | | return goodsEvaluateDao.countValid(); |
| | | } |
| | | |
| | | /** |
| | | * 更新商品信息 |
| | | */ |
| | | public void updateGoodInfo(List<GoodsEvaluate> list) { |
| | | if (!Constant.IS_OUTNET) { |
| | | return; // 外网进行更新 |
| | | } |
| | | |
| | | if (list == null || list.size() == 0) { |
| | | return; |
| | | } |
| | | |
| | | try { |
| | | BigDecimal fanLiRate = hongBaoManageService.getFanLiRate(); |
| | | BigDecimal shareRate = hongBaoManageService.getShareRate(); |
| | | BigDecimal vipFanLiRate = hongBaoManageService.getVIPFanLiRate(); |
| | | ConfigParamsDTO paramsDTO = new ConfigParamsDTO(fanLiRate, shareRate, Constant.MAX_REWARD_RATE, |
| | | vipFanLiRate); |
| | | for (GoodsEvaluate goodsEvaluate : list) { |
| | | // 是否2个小时之内已更新 |
| | | Date updateTime = goodsEvaluate.getUpdateTime(); |
| | | if (updateTime != null) { |
| | | long nd = 1000 * 24 * 60 * 60;// 一天的毫秒数 |
| | | long nh = 1000 * 60 * 60;// 一小时的毫秒数 |
| | | long diff = System.currentTimeMillis() - updateTime.getTime(); |
| | | long day = diff / nd;// 计算差多少天 |
| | | long hour = diff % nd / nh + day * 24;// 计算差多少小时 |
| | | if (hour < 2) { |
| | | continue; |
| | | } |
| | | } |
| | | |
| | | GoodsDetailVO goods = goodsEvaluate.getGoods(); |
| | | if (goods != null) { |
| | | GoodsDetailVO goodsNew = getGoodsNewInfo(goods.getGoodsId(), goods.getGoodsType(), paramsDTO); |
| | | } |
| | | // 更新商品信息 |
| | | List<ImgInfo> imgList = goodsEvaluate.getImgList(); |
| | | if (imgList == null || imgList.size() == 0) { |
| | | continue; |
| | | } |
| | | |
| | | } |
| | | } catch (Exception e) { |
| | | LogHelper.errorDetailInfo(e); |
| | | } |
| | | } |
| | | |
| | | private GoodsDetailVO getGoodsNewInfo(Long goodsId, int goodsType, ConfigParamsDTO paramsDTO) { |
| | | GoodsDetailVO vo = null; |
| | | if (goodsType == Constant.SOURCE_TYPE_TAOBAO) { |
| | | |
| | | } else if (goodsType == Constant.SOURCE_TYPE_JD) { |
| | | JDGoods goodsInfo = jdGoodsCacheUtil.getGoodsInfo(goodsId); |
| | | if (goodsInfo != null) { |
| | | vo = GoodsDetailVOFactory.convertJDGoods(goodsInfo, paramsDTO); |
| | | } |
| | | } else if (goodsType == Constant.SOURCE_TYPE_PDD) { |
| | | PDDGoodsDetail goodsInfo = pinDuoDuoCacheUtil.getGoodsInfo(goodsId); |
| | | if (goodsInfo != null) |
| | | vo = GoodsDetailVOFactory.convertPDDGoods(goodsInfo, paramsDTO); |
| | | } |
| | | return vo; |
| | | } |
| | | |
| | | } |
| | |
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Service;
|
| | | import org.yeshi.utils.JsonUtil;
|
| | |
|
| | | import com.yeshi.fanli.dao.user.DeviceSexDao;
|
| | | import com.yeshi.fanli.entity.bus.homemodule.DeviceSex;
|
| | |
| | | package com.yeshi.fanli.service.impl.money.extract;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Service;
|
| | | import org.yeshi.utils.DateUtil;
|
| | |
|
| | | import com.google.gson.Gson;
|
| | | import com.yeshi.fanli.dao.mybatis.ExtractAuditRecordMapper;
|
| | | import com.yeshi.fanli.dao.user.count.CountUserInfoDao;
|
| | | import com.yeshi.fanli.dto.ChartTDO;
|
| | | import com.yeshi.fanli.dto.money.ExtractOrderStatisticDTO;
|
| | | import com.yeshi.fanli.entity.admin.count.CountUserInfo;
|
| | | import com.yeshi.fanli.entity.admin.count.CountUserInfo.CountUserEnum;
|
| | | import com.yeshi.fanli.entity.bus.user.ExtractAuditRecord;
|
| | | import com.yeshi.fanli.service.inter.money.extract.ExtractAuditRecordService;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | |
|
| | | @Service
|
| | | public class ExtractAuditRecordServiceImpl implements ExtractAuditRecordService {
|
| | |
|
| | | @Resource
|
| | | private ExtractAuditRecordMapper extractAuditRecordMapper;
|
| | | |
| | | @Resource
|
| | | private CountUserInfoDao countUserInfoDao;
|
| | |
|
| | | @Override
|
| | | public List<ExtractAuditRecord> getList(int pageIndex, int pageSize, String key, String startTime, String endTime) {
|
| | |
| | | }
|
| | |
|
| | | @Override
|
| | | public List<ChartTDO> countAuditTotal(Integer state, Integer type, String years, String startTime,
|
| | | String endTime) throws Exception {
|
| | | return extractAuditRecordMapper.countAuditTotal(state, type, years, startTime, endTime);
|
| | | public List<CountUserInfo> getAuditCount(Date startTime, Date endTime, Integer state) throws Exception {
|
| | | // 重新查询统计今日以及空缺
|
| | | initAuditCount();
|
| | | |
| | | return countUserInfoDao.query(CountUserEnum.extractAuditNumber, startTime, endTime, state);
|
| | | }
|
| | |
|
| | | // 初始化统计
|
| | | @Override
|
| | | public List<ChartTDO> countExtractApplyMoney(Integer state, Integer type, String years, String startTime,
|
| | | String endTime) throws Exception {
|
| | | return extractAuditRecordMapper.countExtractMoney(state, type, years, startTime, endTime);
|
| | | public void initAuditCount() {
|
| | | try {
|
| | | CountUserInfo lastRecord = countUserInfoDao.getMaxDate(CountUserEnum.extractAuditNumber);
|
| | | Date lastDay = null;
|
| | | if (lastRecord != null && lastRecord.getDay() != null) {
|
| | | lastDay = lastRecord.getDay();
|
| | | }
|
| | | |
| | | if (lastDay == null) {
|
| | | lastDay = TimeUtil.parse("2017-07-19");
|
| | | }
|
| | | |
| | | Date today = new Date();
|
| | | int betweenDays = DateUtil.daysBetween2(lastDay, today);
|
| | | if (betweenDays > 0) {
|
| | | for (int i = 0; i <= betweenDays; i++ ) {
|
| | | addRecordAuditCount(DateUtil.plusDay(i, lastDay));
|
| | | }
|
| | | }
|
| | | // 重新统计今日
|
| | | addRecordAuditCount(TimeUtil.getGernalTime(today.getTime()));
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | |
| | | private void addRecordAuditCount(String preDay) throws Exception{
|
| | | for (int i = 1; i < 3; i++) {
|
| | | int count = extractAuditRecordMapper.countAuditTotal(i, preDay);
|
| | | CountUserInfo record = new CountUserInfo();
|
| | | record.setState(i);
|
| | | record.setNum(count);
|
| | | record.setId(StringUtil.Md5(preDay + CountUserEnum.extractAuditNumber.name())+ "-" + i);
|
| | | record.setDay(TimeUtil.parse(preDay));
|
| | | record.setType(CountUserEnum.extractAuditNumber);
|
| | | countUserInfoDao.save(record);
|
| | | }
|
| | | } |
| | |
|
| | | |
| | | @Override
|
| | | public List<CountUserInfo> getApplyMoney(Date startTime, Date endTime) throws Exception {
|
| | | // 重新查询统计今日以及空缺
|
| | | initApplyMoneyCount();
|
| | | |
| | | return countUserInfoDao.query(CountUserEnum.extractApplyMoney, startTime, endTime);
|
| | | }
|
| | | |
| | | // 初始化统计
|
| | | @Override
|
| | | public void initApplyMoneyCount() {
|
| | | try {
|
| | | CountUserInfo lastRecord = countUserInfoDao.getMaxDate(CountUserEnum.extractApplyMoney);
|
| | | Date lastDay = null;
|
| | | if (lastRecord != null && lastRecord.getDay() != null) {
|
| | | lastDay = lastRecord.getDay();
|
| | | }
|
| | | |
| | | if (lastDay == null) {
|
| | | lastDay = TimeUtil.parse("2017-07-19");
|
| | | }
|
| | | |
| | | Date today = new Date();
|
| | | int betweenDays = DateUtil.daysBetween2(lastDay, today);
|
| | | if (betweenDays > 0) {
|
| | | for (int i = 0; i <= betweenDays; i++ ) {
|
| | | addRecordApplyMoneyCount(DateUtil.plusDay(i, lastDay));
|
| | | }
|
| | | }
|
| | | // 重新统计今日
|
| | | addRecordApplyMoneyCount(TimeUtil.getGernalTime(today.getTime()));
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | |
| | | private void addRecordApplyMoneyCount(String preDay) throws Exception{
|
| | | BigDecimal money = extractAuditRecordMapper.countApplyExtractMoney(preDay);
|
| | | if (money == null)
|
| | | money = new BigDecimal(0);
|
| | | CountUserInfo record = new CountUserInfo();
|
| | | record.setMoney(money);
|
| | | record.setId(StringUtil.Md5(preDay + CountUserEnum.extractApplyMoney.name()));
|
| | | record.setDay(TimeUtil.parse(preDay));
|
| | | record.setType(CountUserEnum.extractApplyMoney);
|
| | | countUserInfoDao.save(record);
|
| | | } |
| | |
|
| | | @Override
|
| | | public List<ChartTDO> countExtractApplyNumber(Integer state, Integer type, String years,
|
| | | String startTime, String endTime) throws Exception {
|
| | | return extractAuditRecordMapper.countExtractApplyNumber(state, type, years, startTime, endTime);
|
| | | public List<CountUserInfo> geApplyNumber(Date startTime, Date endTime) throws Exception {
|
| | | // 重新查询统计今日以及空缺
|
| | | initApplyNumberCount();
|
| | | |
| | | return countUserInfoDao.query(CountUserEnum.extractApplyNumber, startTime, endTime);
|
| | | }
|
| | |
|
| | | |
| | | // 初始化统计
|
| | | @Override
|
| | | public void initApplyNumberCount() {
|
| | | try {
|
| | | CountUserInfo lastRecord = countUserInfoDao.getMaxDate(CountUserEnum.extractApplyNumber);
|
| | | Date lastDay = null;
|
| | | if (lastRecord != null && lastRecord.getDay() != null) {
|
| | | lastDay = lastRecord.getDay();
|
| | | }
|
| | | |
| | | if (lastDay == null) {
|
| | | lastDay = TimeUtil.parse("2017-07-19");
|
| | | }
|
| | | |
| | | Date today = new Date();
|
| | | int betweenDays = DateUtil.daysBetween2(lastDay, today);
|
| | | if (betweenDays > 0) {
|
| | | for (int i = 0; i <= betweenDays; i++ ) {
|
| | | addRecordCount(DateUtil.plusDay(i, lastDay));
|
| | | }
|
| | | }
|
| | | // 重新统计今日
|
| | | addRecordCount(TimeUtil.getGernalTime(today.getTime()));
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | |
| | | private void addRecordCount(String preDay) throws Exception{
|
| | | int count = extractAuditRecordMapper.countApplyNumberByDay(preDay);
|
| | | CountUserInfo record = new CountUserInfo();
|
| | | record.setNum(count);
|
| | | record.setId(StringUtil.Md5(preDay + CountUserEnum.extractApplyNumber.name()));
|
| | | record.setDay(TimeUtil.parse(preDay));
|
| | | record.setType(CountUserEnum.extractApplyNumber);
|
| | | countUserInfoDao.save(record);
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | package com.yeshi.fanli.service.impl.order;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.ArrayList;
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
| | | import org.springframework.transaction.annotation.Transactional;
|
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.order.LostOrderMapper;
|
| | | import com.yeshi.fanli.dto.ChartTDO;
|
| | | import com.yeshi.fanli.entity.bus.user.HongBaoV2;
|
| | | import com.yeshi.fanli.entity.bus.user.LostOrder;
|
| | | import com.yeshi.fanli.entity.bus.user.Order;
|
| | |
| | | }
|
| | |
|
| | | @Override
|
| | | public List<ChartTDO> countLostNum(Integer dateType, Integer resultCode, String year, String startTime,
|
| | | String endTime) throws Exception {
|
| | | return lostOrderMapper.countLostNum(dateType, resultCode, year, startTime, endTime);
|
| | | public Integer countLostOrderNum(String preDay) {
|
| | | return lostOrderMapper.countLostOrderNum(preDay);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<ChartTDO> countAppealMoney(Integer dateType, String year, String startTime, String endTime)
|
| | | throws Exception {
|
| | | return lostOrderMapper.countAppealMoney(dateType, year, startTime, endTime);
|
| | | public BigDecimal countAppealMoney(String preDay) {
|
| | | return lostOrderMapper.countAppealMoney(preDay);
|
| | | }
|
| | |
|
| | | @Override
|
| | |
| | | return record;
|
| | | }
|
| | |
|
| | | |
| | | @Override
|
| | | public Integer countWeiQaunOrderNumberByDate(String preDay) {
|
| | | return userOrderWeiQuanRecordMapper.countWeiQaunOrderNumberByDate(preDay);
|
| | | }
|
| | | |
| | | |
| | | |
| | | @Override
|
| | | public BigDecimal countWeiQaunOrderMoneyByDate(String preDay) {
|
| | | return userOrderWeiQuanRecordMapper.countWeiQaunOrderMoneyByDate(preDay);
|
| | | }
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.service.impl.user;
|
| | |
|
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Service;
|
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.user.UserInfoRegisterMapper;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfoRegister;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoRegisterService;
|
| | |
|
| | | @Service
|
| | | public class UserInfoRegisterServiceImpl implements UserInfoRegisterService {
|
| | | |
| | | @Resource
|
| | | private UserInfoRegisterMapper userInfoRegisterMapper;
|
| | | |
| | | @Override
|
| | | public List<UserInfoRegister> listByMultipleUids(List<Long> list) {
|
| | | return userInfoRegisterMapper.listByMultipleUids(list);
|
| | | }
|
| | | |
| | | @Override
|
| | | public List<UserInfoRegister> listByMultipleUidAndDay(List<Long> list,String preDay) {
|
| | | return userInfoRegisterMapper.listByMultipleUidAndDay(list, preDay);
|
| | | }
|
| | | |
| | | |
| | | @Override
|
| | | public List<UserInfoRegister> listByChannelAndDay(String channel, String preDay) {
|
| | | return userInfoRegisterMapper.listByChannelAndDay(channel, preDay);
|
| | | }
|
| | | |
| | | @Override
|
| | | public List<Long> listUidByChannelAndDay(String channel, String preDay) {
|
| | | return userInfoRegisterMapper.listUidByChannelAndDay(channel, preDay);
|
| | | }
|
| | | |
| | | @Override
|
| | | public List<Long> listUidByChannel(String channel) {
|
| | | return userInfoRegisterMapper.listUidByChannel(channel);
|
| | | }
|
| | | |
| | | |
| | | @Override
|
| | | public Integer countByChannelAndDay(String channel, String preDay) {
|
| | | return userInfoRegisterMapper.countByChannelAndDay(channel, preDay);
|
| | | }
|
| | | }
|
| | |
| | |
|
| | | import java.util.List;
|
| | |
|
| | | import org.springframework.web.multipart.MultipartFile;
|
| | |
|
| | | import com.yeshi.fanli.entity.bus.activity.ActivityRuleUser;
|
| | | import com.yeshi.fanli.entity.bus.activity.ActivityUser;
|
| | | import com.yeshi.fanli.exception.dynamic.ActivityUserException;
|
| | |
|
| | | /**
|
| | | * 动态服务
|
| | |
| | | * @return
|
| | | */
|
| | | public ActivityUser getRandomHaoHuo();
|
| | |
|
| | | /**
|
| | | * 根据名称查询发布用户
|
| | | * @param nickName
|
| | | * @return
|
| | | */
|
| | | public ActivityUser selectByName(String nickName);
|
| | |
|
| | | public ActivityUser getActivityUserByNickName(ActivityUser record, MultipartFile file) throws ActivityUserException;
|
| | | }
|
| | |
| | | * @return
|
| | | */
|
| | | public BigDecimal getRewardMoneyByToSearch(Long uid, Integer dateType, Integer hbType, Integer orderState, String orderNo,
|
| | | Integer moneyState, String startTime, String endTime, List<Integer> listSource); |
| | | Integer moneyState, String startTime, String endTime, List<Integer> listSource);
|
| | |
|
| | | |
| | | public Integer countOrderByTypeAndDate(Integer orderType, String preDay); |
| | |
|
| | | }
|
| | |
| | | package com.yeshi.fanli.service.inter.count;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
|
| | | import com.yeshi.fanli.dto.ChartTDO;
|
| | | import com.yeshi.fanli.entity.admin.count.CountOrderInfo;
|
| | | import com.yeshi.fanli.entity.admin.count.CountUserInfo;
|
| | | import com.yeshi.fanli.vo.user.UserGoldCoinVO;
|
| | |
|
| | |
|
| | |
| | | public List<UserGoldCoinVO> listByHasGoldCoin(long start, int count, String key);
|
| | |
|
| | | public long countByHasGoldCoin(String key);
|
| | |
|
| | | public List<CountUserInfo> getNewUserData(Date startTime, Date endTime, String channel);
|
| | |
|
| | | public void initChannelUserCount();
|
| | |
|
| | | |
| | | /**
|
| | | * 新用户查询24内下单数量 -有效数量
|
| | | * @param channel
|
| | | * @param startTime
|
| | | * @param endTime
|
| | | * @return
|
| | | */
|
| | | public List<CountOrderInfo> count24HOderByChannel(String channel, Date startTime, Date endTime);
|
| | |
|
| | | /**
|
| | | * 新用户当日下单数量 -有效
|
| | | * @param channel
|
| | | * @param startTime
|
| | | * @param endTime
|
| | | * @return
|
| | | */
|
| | | public List<CountUserInfo> countUserDownOrderByChannelAndToday(String channel, Date startTime, Date endTime);
|
| | |
|
| | | /**
|
| | | * 新用户7天内下单数量- 有效
|
| | | * @param channel
|
| | | * @param startTime
|
| | | * @param endTime
|
| | | * @return
|
| | | */
|
| | | public List<CountUserInfo> countUseByChannelAndWeekOrder(String channel, Date startTime, Date endTime);
|
| | | |
| | | /**
|
| | | * 新用户7天内下3单数量- 有效
|
| | | * @param channel
|
| | | * @param startTime
|
| | | * @param endTime
|
| | | * @return
|
| | | */
|
| | | public List<CountUserInfo> countUseByChannelAndWeekThreeOrder(String channel, Date startTime, Date endTime);
|
| | |
|
| | | /**
|
| | | * 初始化用户7天订单统计
|
| | | */
|
| | | public void initCountUserWeekOrder();
|
| | |
|
| | | /**
|
| | | * 统计订单总数量 -分渠道 有效的
|
| | | * @param channel
|
| | | * @param startTime
|
| | | * @param endTime
|
| | | * @return
|
| | | */
|
| | | public List<CountOrderInfo> countOderByChannel(String channel, Date startTime, Date endTime);
|
| | |
|
| | | /**
|
| | | * 统计订单佣金
|
| | | * @param channel
|
| | | * @param startTime
|
| | | * @param endTime
|
| | | * @return
|
| | | */
|
| | | public List<CountOrderInfo> countHongBaoByChannel(String channel, Date startTime, Date endTime);
|
| | |
|
| | | /**
|
| | | * 统计订单数量-根据类型
|
| | | * @param channel
|
| | | * @param startTime
|
| | | * @param endTime
|
| | | * @return
|
| | | */
|
| | | public List<CountOrderInfo> countOrderType(Integer state, Date startTime, Date endTime);
|
| | |
|
| | | |
| | | /**
|
| | | * 统计维权订单数量
|
| | | * @param state
|
| | | * @param startTime
|
| | | * @param endTime
|
| | | * @return
|
| | | */
|
| | | public List<CountOrderInfo> countWeiQuanOrder(Date startTime, Date endTime);
|
| | |
|
| | | /**
|
| | | * 统计维权金额
|
| | | * @param state
|
| | | * @param startTime
|
| | | * @param endTime
|
| | | * @return
|
| | | */
|
| | | public List<CountOrderInfo> countWeiQuanOrderMoney(Date startTime, Date endTime);
|
| | |
|
| | | /**
|
| | | * 统计订单找回金额
|
| | | * @param startTime
|
| | | * @param endTime
|
| | | * @return
|
| | | */
|
| | | public List<CountOrderInfo> counOrderLastMoney(Date startTime, Date endTime);
|
| | |
|
| | | /**
|
| | | * 统计订单找回个数
|
| | | * @param startTime
|
| | | * @param endTime
|
| | | * @return
|
| | | */
|
| | | public List<CountOrderInfo> counOrderLastNum(Date startTime, Date endTime);
|
| | |
|
| | | |
| | | /**
|
| | | * 统计订单总佣金
|
| | | * @param startTime
|
| | | * @param endTime
|
| | | * @return
|
| | | */
|
| | | public List<CountOrderInfo> counOrderTotalCommission(Date startTime, Date endTime);
|
| | |
|
| | | /**
|
| | | * 订单总单数
|
| | | * @param startTime
|
| | | * @param endTime
|
| | | * @return
|
| | | */
|
| | | public List<CountOrderInfo> counOrderTotalNum(Date startTime, Date endTime);
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.service.inter.dynamic; |
| | | |
| | | import java.util.List; |
| | | |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | import org.springframework.web.multipart.MultipartHttpServletRequest; |
| | | |
| | | import com.yeshi.fanli.entity.dynamic.CommentInfo; |
| | | import com.yeshi.fanli.entity.dynamic.GoodsEvaluate; |
| | | import com.yeshi.fanli.entity.dynamic.ImgInfo; |
| | | import com.yeshi.fanli.exception.dynamic.GoodsEvaluateException; |
| | | |
| | | public interface GoodsEvaluateService { |
| | | |
| | | public void saveHead(MultipartFile file, GoodsEvaluate record) throws GoodsEvaluateException; |
| | | |
| | | |
| | | public GoodsEvaluate getById(String id); |
| | | |
| | | public void deleteBatchByPrimaryKey(List<String> list); |
| | | |
| | | |
| | | /** |
| | | * 查询有效并缓存 |
| | | * @param start |
| | | * @param count |
| | | * @return |
| | | */ |
| | | public List<GoodsEvaluate> queryValidEvaluateCache(int start, int count); |
| | | |
| | | public long countValid(); |
| | | |
| | | /** |
| | | * 查询 |
| | | * @param start |
| | | * @param count |
| | | * @param key |
| | | * @param state |
| | | * @return |
| | | */ |
| | | public List<GoodsEvaluate> query(int start, int count, String key, Integer state); |
| | | |
| | | public long count(String key, Integer state); |
| | | |
| | | |
| | | /** |
| | | * 添加分享次数 |
| | | * @param id |
| | | */ |
| | | public void addShareNum(String id); |
| | | |
| | | |
| | | /** |
| | | * 保存评论 |
| | | * @param pid |
| | | * @param commentInfo |
| | | * @throws GoodsEvaluateException |
| | | */ |
| | | public void saveComment(String pid, CommentInfo commentInfo) throws GoodsEvaluateException; |
| | | |
| | | |
| | | public void deleteComment(String pid, List<String> list) throws GoodsEvaluateException; |
| | | |
| | | |
| | | /** |
| | | * 保存商品信息单个 |
| | | * @param pid |
| | | * @param goodsId |
| | | * @param goodsType |
| | | * @param videoUrl |
| | | * @param picNum |
| | | * @param picUrls |
| | | * @param fileRequest |
| | | * @throws GoodsEvaluateException |
| | | * @throws Exception |
| | | */ |
| | | public void saveSingleGoods(String pid, Long goodsId, Integer goodsType, String videoUrl, Integer picNum, String picUrls, |
| | | MultipartHttpServletRequest fileRequest) throws GoodsEvaluateException, Exception; |
| | | |
| | | /** |
| | | * 单个商品券信息 |
| | | * @param pid |
| | | * @param commentInfo |
| | | * @throws GoodsEvaluateException |
| | | * @throws Exception |
| | | */ |
| | | public void saveSingleGoodsCoupon(String pid, CommentInfo commentInfo) throws GoodsEvaluateException, Exception; |
| | | |
| | | |
| | | public void saveActivityPic(String pid, ImgInfo imgInfo, MultipartHttpServletRequest fileRequest) |
| | | throws GoodsEvaluateException, Exception; |
| | | |
| | | |
| | | } |
| | |
| | | package com.yeshi.fanli.service.inter.money.extract;
|
| | |
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
|
| | | import com.yeshi.fanli.dto.ChartTDO;
|
| | | import com.yeshi.fanli.entity.admin.count.CountUserInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.ExtractAuditRecord;
|
| | |
|
| | | public interface ExtractAuditRecordService {
|
| | |
| | | public List<ExtractAuditRecord> getbyExtractId(Long extractId);
|
| | |
|
| | |
|
| | | /**
|
| | | * 统计审核次数 |
| | | * @param state
|
| | | * @param type
|
| | | * @param years
|
| | | * @param startTime
|
| | | * @param endTime
|
| | | * @return
|
| | | */
|
| | | public List<ChartTDO>countAuditTotal(Integer state, Integer type, String years, String startTime,
|
| | | String endTime) throws Exception;
|
| | | |
| | | |
| | |
|
| | | /**
|
| | | * 统计申请提的现总金额
|
| | | * @param state
|
| | | * @param type
|
| | | * @param years
|
| | | * @param startTime
|
| | | * @param endTime
|
| | | * @return
|
| | | */
|
| | | public List<ChartTDO> countExtractApplyMoney(Integer state, Integer type, String years, String startTime,
|
| | | String endTime) throws Exception;
|
| | |
|
| | | public List<CountUserInfo> getApplyMoney(Date startTime, Date endTime) throws Exception;
|
| | | |
| | | public void initApplyMoneyCount();
|
| | | |
| | | /**
|
| | | * 统计申请提的现总次数
|
| | | * @param state
|
| | | * @param type
|
| | | * @param years
|
| | | * @param startTime
|
| | | * @param endTime
|
| | | * @return
|
| | | */
|
| | | public List<ChartTDO> countExtractApplyNumber(Integer state, Integer type, String years, String startTime,
|
| | | String endTime) throws Exception;
|
| | | |
| | | List<CountUserInfo> geApplyNumber(Date startTime, Date endTime) throws Exception;
|
| | |
|
| | | public void initApplyNumberCount();
|
| | |
|
| | | public void initAuditCount();
|
| | |
|
| | | public List<CountUserInfo> getAuditCount(Date startTime, Date endTime, Integer state) throws Exception;
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | | }
|
| | |
| | | package com.yeshi.fanli.service.inter.order;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | |
|
| | | import com.yeshi.fanli.dto.ChartTDO;
|
| | | import com.yeshi.fanli.dto.order.CountOrderDTO;
|
| | | import com.yeshi.fanli.entity.admin.count.CountOrderTrackRate;
|
| | |
|
| | | public interface CommonOrderCountService {
|
| | |
|
| | |
| | | */
|
| | | public Long countByState(Integer state);
|
| | |
|
| | | /**
|
| | | * 统计所有订单
|
| | | * |
| | | * @param channel
|
| | | * @return
|
| | | */
|
| | | public List<ChartTDO> getTrackAccuracyRate(Integer dateType, String year, String startTime, String endTime,
|
| | | int sourceType) throws Exception;
|
| | |
|
| | | /**
|
| | | * 统计总金额
|
| | |
| | | */
|
| | | List<Long> getSameGoodsOrderByUidAndHongBaoType(List<Integer> typeList, Long uid, int minSameGoodsOrderCount);
|
| | |
|
| | | /**
|
| | | * 统计日期内产生有效订单数量(返利 + 分享)
|
| | | * @param preDay
|
| | | * @param uid
|
| | | * @return
|
| | | */
|
| | | public Integer countOderByUidAndDate(Date preDay, Long uid);
|
| | | |
| | | /**
|
| | | * 统计日期内产生有效订单数量(返利 + 分享) 多个uid
|
| | | * @param preDay
|
| | | * @param uid
|
| | | * @return
|
| | | */
|
| | | //public Integer countOrderByUidsAndDate(Date preDay, List<Long> list);
|
| | | /**
|
| | | * 统计再此时间内 产生订单的用户数量
|
| | | * @param preDay
|
| | | * @param list
|
| | | * @return
|
| | | */
|
| | | public Integer countDownOrderUserByUidAndDate(Date preDay, List<Long> list);
|
| | |
|
| | | /**
|
| | | * 统计订单佣金
|
| | | * @param preDay
|
| | | * @param list
|
| | | * @return
|
| | | */
|
| | | List<CountOrderDTO> countCommissionByDay(String preDay);
|
| | | |
| | | /**
|
| | | * 总订单数 每-天
|
| | | * @param preDay
|
| | | * @return
|
| | | */
|
| | | public Integer countOderByDate(String preDay);
|
| | |
|
| | | /**
|
| | | * 统计订单佣金
|
| | | * @param preDay
|
| | | * @return
|
| | | */
|
| | | public BigDecimal countCommissionByDate(String preDay);
|
| | |
|
| | | /**
|
| | | * 当日每个用户下单数量
|
| | | * @param preDay
|
| | | * @return
|
| | | */
|
| | | public List<CountOrderDTO> countValidOrderByDay(String preDay);
|
| | |
|
| | | /**
|
| | | * 统计跟踪率
|
| | | * @param type
|
| | | * @param startTime
|
| | | * @param endTime
|
| | | * @return
|
| | | */
|
| | | public List<CountOrderTrackRate> getOrderTrackRate(int type, Date startTime, Date endTime);
|
| | |
|
| | | |
| | | }
|
| | |
| | | package com.yeshi.fanli.service.inter.order;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | | import java.util.concurrent.locks.ReentrantReadWriteLock;
|
| | |
|
| | | import com.yeshi.fanli.dto.ChartTDO;
|
| | | import com.yeshi.fanli.entity.bus.user.LostOrder;
|
| | |
|
| | | public interface LostOrderService {
|
| | |
| | |
|
| | | public long countQuery(String key, Integer state, Integer handleType, Integer type);
|
| | |
|
| | | /**
|
| | | * 本月申诉订单数 统计
|
| | | * |
| | | * @param dateType
|
| | | * @param resultCode
|
| | | * (未处理: 成功 失败)
|
| | | * @param year
|
| | | * @param startTime
|
| | | * @param endTime
|
| | | * @return
|
| | | * @throws Exception
|
| | | */
|
| | | public List<ChartTDO> countLostNum(Integer dateType, Integer resultCode, String year, String startTime,
|
| | | String endTime) throws Exception;
|
| | |
|
| | | public List<ChartTDO> countAppealMoney(Integer dateType, String year, String startTime, String endTime)
|
| | | throws Exception;
|
| | |
|
| | |
|
| | | /**
|
| | | * 根据状态与处理结果过去值
|
| | |
| | | */
|
| | | public List<LostOrder> listByStateAndResultCode(int state, int resultCode, int page, int pageSize);
|
| | |
|
| | | |
| | | /**
|
| | | * 统计申诉订单数量
|
| | | * @param preDay
|
| | | * @return
|
| | | */
|
| | | public Integer countLostOrderNum(String preDay);
|
| | | |
| | | /**
|
| | | * 统计申诉找回佣金
|
| | | * @param preDay
|
| | | * @return
|
| | | */
|
| | | public BigDecimal countAppealMoney(String preDay);
|
| | |
|
| | | }
|
| | |
| | | package com.yeshi.fanli.service.inter.order;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | |
|
| | | import com.yeshi.fanli.entity.order.UserOrderWeiQuanRecord;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoWeiQuanOrder;
|
| | |
|
| | |
| | |
|
| | | public UserOrderWeiQuanRecord selectByOrderInfoAndUid(Long uid, String tradeId, int sourceType);
|
| | |
|
| | | /**
|
| | | * 统计数量 订单分组 日期筛选
|
| | | * @param preDay
|
| | | * @return
|
| | | */
|
| | | public Integer countWeiQaunOrderNumberByDate(String preDay);
|
| | |
|
| | | /**
|
| | | * 订单维权金额
|
| | | * @param preDay
|
| | | * @return
|
| | | */
|
| | | public BigDecimal countWeiQaunOrderMoneyByDate(String preDay);
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.service.inter.user;
|
| | |
|
| | | import java.util.List;
|
| | |
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfoRegister;
|
| | |
|
| | | public interface UserInfoRegisterService {
|
| | |
|
| | | /**
|
| | | * 根据多个用户id查询
|
| | | * @param list
|
| | | * @return
|
| | | */
|
| | | public List<UserInfoRegister> listByMultipleUids(List<Long> list);
|
| | |
|
| | | public List<UserInfoRegister> listByMultipleUidAndDay(List<Long> list, String preDay);
|
| | |
|
| | | |
| | | /**
|
| | | * 根据渠道id查询用户
|
| | | * @param channel
|
| | | * @return
|
| | | */
|
| | | public List<Long> listUidByChannel(String channel);
|
| | | |
| | | /**
|
| | | * 根据渠道id查询用户
|
| | | * @param channel
|
| | | * @return
|
| | | */
|
| | | public List<Long> listUidByChannelAndDay(String channel, String preDay);
|
| | |
|
| | | |
| | | public List<UserInfoRegister> listByChannelAndDay(String channel, String preDay);
|
| | |
|
| | | |
| | | /**
|
| | | * 统计渠道每天新增个数
|
| | | * @param channel
|
| | | * @param preDay
|
| | | * @return
|
| | | */
|
| | | public Integer countByChannelAndDay(String channel, String preDay);
|
| | |
|
| | | }
|
| | |
| | | specialCard("/editor/img/special_card/", "专题管理图片"),
|
| | | special("/editor/img/special/", "专题图片"),
|
| | | swiper("/editor/img/swiper_pic/", "轮播图片"),
|
| | | activityUser("/editor/img/activityUser/", "动态用户"),
|
| | | goodsEvaluate("/editor/img/evaluate/", "动态发圈"),
|
| | | banLiShopClass("/editor/img/shop/goods_class/", "板栗商城分类图片"),
|
| | | banLiShopGoods("/editor/img/shop/goods/", "板栗商城商品图片");
|
| | |
|
| | |
| | | import java.text.SimpleDateFormat;
|
| | | import java.util.ArrayList;
|
| | | import java.util.Arrays;
|
| | | import java.util.Collections;
|
| | | import java.util.Comparator;
|
| | | import java.util.Date;
|
| | | import java.util.HashSet;
|
| | | import java.util.List;
|
| | |
| | | return goodsInfo;
|
| | | }
|
| | |
|
| | | |
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.util.mybatishandler; |
| | | |
| | | import java.sql.CallableStatement; |
| | | import java.sql.PreparedStatement; |
| | | import java.sql.ResultSet; |
| | | import java.sql.SQLException; |
| | | |
| | | import org.apache.ibatis.type.BaseTypeHandler; |
| | | import org.apache.ibatis.type.JdbcType; |
| | | |
| | | import com.yeshi.fanli.entity.system.ChannelEnum; |
| | | |
| | | public class ChannelEnumHandler extends BaseTypeHandler<ChannelEnum> { |
| | | |
| | | @Override |
| | | public ChannelEnum getNullableResult(ResultSet arg0, String arg1) throws SQLException { |
| | | String key = arg0.getString(arg1); |
| | | if (arg0.wasNull()) { |
| | | return null; |
| | | } else { |
| | | return ChannelEnum.valueOf(key); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public ChannelEnum getNullableResult(ResultSet arg0, int arg1) throws SQLException { |
| | | String key = arg0.getString(arg1); |
| | | if (arg0.wasNull()) { |
| | | return null; |
| | | } else { |
| | | // 根据数据库中的key值,定位SexEnum子类 |
| | | return ChannelEnum.valueOf(key); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public ChannelEnum getNullableResult(CallableStatement arg0, int arg1) throws SQLException { |
| | | String key = arg0.getString(arg1); |
| | | if (arg0.wasNull()) { |
| | | return null; |
| | | } else { |
| | | // 根据数据库中的key值,定位SexEnum子类 |
| | | return ChannelEnum.valueOf(key); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void setNonNullParameter(PreparedStatement arg0, int arg1, ChannelEnum arg2, JdbcType arg3) |
| | | throws SQLException { |
| | | arg0.setString(arg1, arg2.name()); |
| | | } |
| | | |
| | | } |
| | |
| | |
|
| | | return format.format(ca.getTime());
|
| | | }
|
| | | |
| | | /**
|
| | | * 指定日期加上天数后的日期
|
| | | * |
| | | * @param num 增加的天数
|
| | | * @param nowDate 创建时间
|
| | | * @return
|
| | | * @throws ParseException
|
| | | */
|
| | | public static Date plusDayReturnDate(int num, String nowDate) throws ParseException {
|
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
|
| | | Date currdate = format.parse(nowDate);
|
| | | Calendar ca = Calendar.getInstance();
|
| | | ca.setTime(currdate);
|
| | | ca.add(Calendar.DATE, num);
|
| | | return ca.getTime();
|
| | | }
|
| | |
|
| | | /**
|
| | | * 指定日期加上天数后的日期
|
| | |
| | | return format.format(ca.getTime());
|
| | | }
|
| | |
|
| | | |
| | | /**
|
| | | * 指定日期加上天数后的日期
|
| | | *
|
| | |
| | | * @return
|
| | | * @throws ParseException
|
| | | */
|
| | | public static String reduceDay2(int num, Date date) throws ParseException {
|
| | | // 设置要获取到什么样的时间
|
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
|
| | | // 获取String类型的时间
|
| | | String date_str = format.format(date);
|
| | | Date currdate = format.parse(date_str);
|
| | |
|
| | | Calendar ca = Calendar.getInstance();
|
| | | ca.setTime(currdate);
|
| | | ca.add(Calendar.DATE, -num); // 日期减 如果不够减会将月变动
|
| | |
|
| | | return format.format(ca.getTime());
|
| | | }
|
| | | |
| | | /**
|
| | | * 指定日期减去天数后的日期
|
| | | * |
| | | * @param num 减去的天数
|
| | | * @param nowDate 创建时间
|
| | | * @return
|
| | | * @throws ParseException
|
| | | */
|
| | | public static Date reduceDay(int num, Date date) throws ParseException {
|
| | | // 设置要获取到什么样的时间
|
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
|