|
@@ -879,4 +879,188 @@ public class JiaoYangDingPanController extends BaseController {
|
|
|
return returnJson;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ @GetMapping("/getTeamExpertBusinessDetail")
|
|
|
+ @ApiOperation(value = "切片盯盘")
|
|
|
+ public JSONObject getTeamExpertBusinessDetail(Long userId, String userType, String startDate, String endDate) {
|
|
|
+ Map<String, Object> requestMap = new HashMap<>();
|
|
|
+ JSONObject returnJson = new JSONObject();
|
|
|
+ try {
|
|
|
+ if (Check.isNull(userType)) {
|
|
|
+ throw new Exception("请传入类型");
|
|
|
+ }
|
|
|
+ if (Check.isNull(userId)) {
|
|
|
+ throw new Exception("请传入用户id");
|
|
|
+ }
|
|
|
+ if (Check.isNull(startDate)) {
|
|
|
+ throw new Exception("请传入开始日期");
|
|
|
+ }
|
|
|
+ if (Check.isNull(endDate)) {
|
|
|
+ throw new Exception("请传入结束日期");
|
|
|
+ }
|
|
|
+ List<Long> promoterIds = new ArrayList<>();
|
|
|
+ if ("导师".equals(userType)) {
|
|
|
+ promoterIds = jiaoYangDingPanService.getPromoterIdsByMentorId(userId);
|
|
|
+ }
|
|
|
+ if ("商务".equals(userType)) {
|
|
|
+ promoterIds = jiaoYangDingPanService.getPromoterIdsByBusinessId(userId);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ if (Check.isNull(promoterIds)) {
|
|
|
+ returnJson.put("data", null);
|
|
|
+ returnJson.put("code", 200);
|
|
|
+ returnJson.put("success", true);
|
|
|
+ return returnJson;
|
|
|
+ }
|
|
|
+ requestMap.put("promoterIds", promoterIds);
|
|
|
+ Long start = DateUtils.strDateToInt(startDate);
|
|
|
+ Long end = DateUtils.strDateToInt(endDate);
|
|
|
+ requestMap.put("start", start);
|
|
|
+ requestMap.put("end", end);
|
|
|
+ SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+ int differDay = DateUtils.differentDaysByMillisecond(simpleDateFormat.parse(startDate), simpleDateFormat.parse(endDate));
|
|
|
+ String lastEndStr = DateUtils.getAnotherDay("yyyy-MM-dd", startDate, -1); // 上一时段结束日期
|
|
|
+ String lastStartStr = DateUtils.getAnotherDay("yyyy-MM-dd", lastEndStr, -differDay); // 上一时段开始日期
|
|
|
+ requestMap.put("lastEnd", DateUtils.strDateToInt(lastEndStr));
|
|
|
+ requestMap.put("lastStart", DateUtils.strDateToInt(lastStartStr));
|
|
|
+ Long nowDate = Long.valueOf(DateUtils.getNowDate("yyyyMMdd"));
|
|
|
+ if (start.equals(nowDate) && end.equals(nowDate)) {
|
|
|
+ Integer nowHour = DateUtils.getNowHour();
|
|
|
+ requestMap.put("nowHour", nowHour);
|
|
|
+ }
|
|
|
+ List<JSONObject> data = jiaoYangDingPanService.getTeamDetail(requestMap);
|
|
|
+ returnJson.put("data", data);
|
|
|
+ returnJson.put("code", 200);
|
|
|
+ returnJson.put("success", true);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ returnJson.put("code", 500);
|
|
|
+ returnJson.put("success", false);
|
|
|
+ returnJson.put("message", e.getMessage());
|
|
|
+ }
|
|
|
+ return returnJson;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @GetMapping("/getPromoterItemDetail")
|
|
|
+ @ApiOperation(value = "切片盯盘")
|
|
|
+ public JSONObject getPromoterItemDetail(Long clipUserId, String startDate, String endDate) {
|
|
|
+ Map<String, Object> requestMap = new HashMap<>();
|
|
|
+ JSONObject returnJson = new JSONObject();
|
|
|
+ try {
|
|
|
+ if (Check.isNull(clipUserId)) {
|
|
|
+ throw new Exception("请传入达人ID");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (Check.isNull(startDate)) {
|
|
|
+ throw new Exception("请传入开始日期");
|
|
|
+ }
|
|
|
+ if (Check.isNull(endDate)) {
|
|
|
+ throw new Exception("请传入结束日期");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ requestMap.put("clipUserId", clipUserId);
|
|
|
+ Long start = DateUtils.strDateToInt(startDate);
|
|
|
+ Long end = DateUtils.strDateToInt(endDate);
|
|
|
+ requestMap.put("start", start);
|
|
|
+ requestMap.put("end", end);
|
|
|
+ SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+ int differDay = DateUtils.differentDaysByMillisecond(simpleDateFormat.parse(startDate), simpleDateFormat.parse(endDate));
|
|
|
+ String lastEndStr = DateUtils.getAnotherDay("yyyy-MM-dd", startDate, -1); // 上一时段结束日期
|
|
|
+ String lastStartStr = DateUtils.getAnotherDay("yyyy-MM-dd", lastEndStr, -differDay); // 上一时段开始日期
|
|
|
+ requestMap.put("lastEnd", DateUtils.strDateToInt(lastEndStr));
|
|
|
+ requestMap.put("lastStart", DateUtils.strDateToInt(lastStartStr));
|
|
|
+ Long nowDate = Long.valueOf(DateUtils.getNowDate("yyyyMMdd"));
|
|
|
+ if (start.equals(nowDate) && end.equals(nowDate)) {
|
|
|
+ Integer nowHour = DateUtils.getNowHour();
|
|
|
+ requestMap.put("nowHour", nowHour);
|
|
|
+ }
|
|
|
+ List<JSONObject> data = jiaoYangDingPanService.getPromoterItemDetail(requestMap);
|
|
|
+ returnJson.put("data", data);
|
|
|
+ returnJson.put("code", 200);
|
|
|
+ returnJson.put("success", true);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ returnJson.put("code", 500);
|
|
|
+ returnJson.put("success", false);
|
|
|
+ returnJson.put("message", e.getMessage());
|
|
|
+ }
|
|
|
+ return returnJson;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @GetMapping("/getItemPromoterDetail")
|
|
|
+ @ApiOperation(value = "切片盯盘")
|
|
|
+ public JSONObject getItemPromoterDetail(Long userId, String startDate, String endDate, Long itemId) {
|
|
|
+ Map<String, Object> requestMap = new HashMap<>();
|
|
|
+ JSONObject returnJson = new JSONObject();
|
|
|
+ try {
|
|
|
+ if (Check.isNull(userId)) {
|
|
|
+ throw new Exception("请传入用户id");
|
|
|
+ }
|
|
|
+ if (Check.isNull(startDate)) {
|
|
|
+ throw new Exception("请传入开始日期");
|
|
|
+ }
|
|
|
+ if (Check.isNull(endDate)) {
|
|
|
+ throw new Exception("请传入结束日期");
|
|
|
+ }
|
|
|
+ if (Check.isNull(itemId)) {
|
|
|
+ throw new Exception("请传入商品id");
|
|
|
+ }
|
|
|
+ String roleId = sysRoleService.getRoleBYUserId(userId);
|
|
|
+ // 剪手经理,渠道经理 查询部门下所有成员数据
|
|
|
+ List<Long> promoterIds = new ArrayList<>();
|
|
|
+ if ("jy_bd".equals(roleId) || "jy_bd_manage".equals(roleId) || "jy_scissors_manage".equals(roleId) || "jy_scissors".equals(roleId) || "jy_out_operation_manager".equals(roleId) || "jy_out_operation".equals(roleId)) {
|
|
|
+ List<Long> userIds = new ArrayList<>();
|
|
|
+ if ("jy_bd_manage".equals(roleId) || "jy_scissors_manage".equals(roleId) || "jy_out_operation_manager".equals(roleId)) {
|
|
|
+ Long deptId = sysDeptService.getDeptIdByUserId(userId);
|
|
|
+ userIds = sysDeptService.getDeptUserListByDeptId(deptId);
|
|
|
+ } else {
|
|
|
+ userIds.add(userId);
|
|
|
+ }
|
|
|
+ promoterIds = jiaoYangDingPanService.getPromoterIdsByUserIds(userIds);
|
|
|
+ } else if ("jy_expert_business".equals(roleId)) {
|
|
|
+ promoterIds = jiaoYangDingPanService.getPromoterIdsByBusinessId(userId);
|
|
|
+ }
|
|
|
+ if (!"admin".equals(roleId) && !"jy_admnin".equals(roleId) && !"jy_expert_mentor".equals(roleId)) {
|
|
|
+ if (Check.isNull(promoterIds)) {
|
|
|
+ throw new Exception("该用户下未查询到绑定达人");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!Check.isNull(promoterIds)) {
|
|
|
+ requestMap.put("promoterIds", promoterIds);
|
|
|
+ }
|
|
|
+
|
|
|
+ requestMap.put("itemId", itemId);
|
|
|
+
|
|
|
+ Long start = DateUtils.strDateToInt(startDate);
|
|
|
+ Long end = DateUtils.strDateToInt(endDate);
|
|
|
+ requestMap.put("start", start);
|
|
|
+ requestMap.put("end", end);
|
|
|
+ SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+ int differDay = DateUtils.differentDaysByMillisecond(simpleDateFormat.parse(startDate), simpleDateFormat.parse(endDate));
|
|
|
+ String lastEndStr = DateUtils.getAnotherDay("yyyy-MM-dd", startDate, -1); // 上一时段结束日期
|
|
|
+ String lastStartStr = DateUtils.getAnotherDay("yyyy-MM-dd", lastEndStr, -differDay); // 上一时段开始日期
|
|
|
+ requestMap.put("lastEnd", DateUtils.strDateToInt(lastEndStr));
|
|
|
+ requestMap.put("lastStart", DateUtils.strDateToInt(lastStartStr));
|
|
|
+ Long nowDate = Long.valueOf(DateUtils.getNowDate("yyyyMMdd"));
|
|
|
+ if (start.equals(nowDate) && end.equals(nowDate)) {
|
|
|
+ Integer nowHour = DateUtils.getNowHour();
|
|
|
+ requestMap.put("nowHour", nowHour);
|
|
|
+ }
|
|
|
+ List<JSONObject> data = jiaoYangDingPanService.getItemPromoterDetail(requestMap);
|
|
|
+ returnJson.put("code", 200);
|
|
|
+ returnJson.put("data", data);
|
|
|
+ returnJson.put("success", true);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ returnJson.put("code", 500);
|
|
|
+ returnJson.put("message", e.getMessage());
|
|
|
+ }
|
|
|
+ return returnJson;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|