|
@@ -62,6 +62,22 @@ public class KwaixiaodianItemGetController extends BaseController {
|
|
|
@Autowired
|
|
|
private ISysUserService sysUserService;
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+ @GetMapping(value = "/{id}")
|
|
|
+ public AjaxResult getInfo(@PathVariable("id") Long id)
|
|
|
+ {
|
|
|
+ return AjaxResult.success(kwaixiaodianItemGetService.selectKwaixiaodianItemGetById(id));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ @PutMapping
|
|
|
+ public AjaxResult edit(@RequestBody KwaixiaodianItemGet kwaixiaodianItemGet)
|
|
|
+ {
|
|
|
+ return toAjax(kwaixiaodianItemGetService.updateKwaixiaodianItemGet(kwaixiaodianItemGet));
|
|
|
+ }
|
|
|
+
|
|
|
@GetMapping("/list")
|
|
|
public TableDataInfo list(Long itemId, String title, Integer itemType, Long userId) {
|
|
|
TableDataInfo rspData = new TableDataInfo();
|
|
@@ -144,6 +160,30 @@ public class KwaixiaodianItemGetController extends BaseController {
|
|
|
return returnJson;
|
|
|
}
|
|
|
|
|
|
+ @GetMapping("/getCourtshipPurchaseIds")
|
|
|
+ public JSONObject getCourtshipPurchaseIds(Long userId) {
|
|
|
+
|
|
|
+ JSONObject returnJson = new JSONObject();
|
|
|
+ try {
|
|
|
+ if (Check.isNull(userId)) {
|
|
|
+ throw new Exception("请传入用户ID");
|
|
|
+ }
|
|
|
+ Long companyId = kwaixiaodianItemGetService.getCompanyId(userId);
|
|
|
+
|
|
|
+ List<JSONObject> userIds = kwaixiaodianItemGetService.getCourtshipPurchaseIds(companyId);
|
|
|
+ returnJson.put("code", 200);
|
|
|
+ returnJson.put("success", true);
|
|
|
+ returnJson.put("data", userIds);
|
|
|
+
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ returnJson.put("code", 500);
|
|
|
+ returnJson.put("success", false);
|
|
|
+ returnJson.put("message", e.getMessage());
|
|
|
+ }
|
|
|
+ return returnJson;
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* 获取商品详情(open.item.get)
|
|
@@ -172,6 +212,10 @@ public class KwaixiaodianItemGetController extends BaseController {
|
|
|
if (Check.isNull(itemType)) {
|
|
|
throw new Exception("未选择选品方式");
|
|
|
}
|
|
|
+
|
|
|
+ Long courtshipPurchaseId = requestJson.getLong("courtshipPurchaseId");
|
|
|
+
|
|
|
+
|
|
|
SysUser sysUser = sysUserService.selectUserById(userId);
|
|
|
if (Check.isNull(sysUser)) {
|
|
|
throw new Exception("用户信息为空");
|
|
@@ -180,13 +224,15 @@ public class KwaixiaodianItemGetController extends BaseController {
|
|
|
if (Check.isNull(token)) {
|
|
|
throw new Exception("未获取到授权信息,请联系管理员");
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
Long companyId = token.getCompanyId();
|
|
|
Integer count = kwaixiaodianItemGetService.checkItem(companyId, itemId);
|
|
|
if (count >= 1) {
|
|
|
throw new Exception("此商品已绑定");
|
|
|
}
|
|
|
|
|
|
- JSONObject jsonObject = kwaixiaodianItemGetService.querykwaiItmInfo(token, itemId, shopId, userId, sysUser.getNickName(), itemType);
|
|
|
+ JSONObject jsonObject = kwaixiaodianItemGetService.querykwaiItmInfo(token, itemId, shopId, userId, sysUser.getNickName(), itemType, courtshipPurchaseId);
|
|
|
if (jsonObject.getBoolean("success")) {
|
|
|
returnJson.put("code", 200);
|
|
|
returnJson.put("success", true);
|
|
@@ -214,7 +260,7 @@ public class KwaixiaodianItemGetController extends BaseController {
|
|
|
|
|
|
|
|
|
@GetMapping("/queryItemReport")
|
|
|
- public TableDataInfo getDingPanMentorBusinessList(Long userId, String startDate, String endDate, String shopId, Long itemId, String itemTitle) {
|
|
|
+ public TableDataInfo getDingPanMentorBusinessList(Long userId, String startDate, String endDate, String shopId, Long itemId, String itemTitle, Integer itemType) {
|
|
|
|
|
|
TableDataInfo rspData = new TableDataInfo();
|
|
|
try {
|
|
@@ -238,16 +284,26 @@ public class KwaixiaodianItemGetController extends BaseController {
|
|
|
throw new Exception("此用户未查询到归属公司");
|
|
|
}
|
|
|
requestMap.put("companyId", companyId);
|
|
|
- } else if ("industry_sale_manager".equals(roleId) || "industry_courtship_manager".equals(roleId) || "industry_purchase_manager".equals(roleId)) { // 经理角色查看部门下所有成员数据
|
|
|
+ } else if ("industry_sale_manager".equals(roleId)) { // 销售经理角色查看部门下所有成员数据
|
|
|
List<Long> userIds = kwaixiaodianItemGetService.getUserIds(userId);
|
|
|
if (Check.isNull(userIds)) {
|
|
|
throw new Exception("此用户未查询到部门成员信息");
|
|
|
}
|
|
|
requestMap.put("userIds", userIds);
|
|
|
- } else if ("industry_sale".equals(roleId) || "industry_purchase".equals(roleId) || "industry_courtship".equals(roleId)) { // 销售 采购 招商 查看自己的数据
|
|
|
+ } else if ("industry_sale".equals(roleId)) { // 销售 查看自己的数据
|
|
|
List<Long> userIds = new ArrayList<>();
|
|
|
userIds.add(userId);
|
|
|
requestMap.put("userIds", userIds);
|
|
|
+ } else if ("industry_courtship_manager".equals(roleId) || "industry_purchase_manager".equals(roleId)) { // 招商、采购经理角色查看部门下所有成员数据
|
|
|
+ List<Long> courtshipPurchaseIds = kwaixiaodianItemGetService.getUserIds(userId);
|
|
|
+ if (Check.isNull(courtshipPurchaseIds)) {
|
|
|
+ throw new Exception("此用户未查询到部门成员信息");
|
|
|
+ }
|
|
|
+ requestMap.put("courtshipPurchaseIds", courtshipPurchaseIds);
|
|
|
+ } else if ("industry_purchase".equals(roleId) || "industry_courtship".equals(roleId)) { // 采购 招商 查看自己的数据
|
|
|
+ List<Long> courtshipPurchaseIds = new ArrayList<>();
|
|
|
+ courtshipPurchaseIds.add(userId);
|
|
|
+ requestMap.put("courtshipPurchaseIds", courtshipPurchaseIds);
|
|
|
}
|
|
|
|
|
|
if (!Check.isNull(shopId)) {
|
|
@@ -262,6 +318,10 @@ public class KwaixiaodianItemGetController extends BaseController {
|
|
|
requestMap.put("itemTitle", itemTitle);
|
|
|
}
|
|
|
|
|
|
+ if (!Check.isNull(itemType)) {
|
|
|
+ requestMap.put("itemType", itemType);
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
Long start = DateUtils.strDateToInt(startDate);
|
|
|
Long end = DateUtils.strDateToInt(endDate);
|
|
@@ -294,7 +354,7 @@ public class KwaixiaodianItemGetController extends BaseController {
|
|
|
|
|
|
|
|
|
@GetMapping("/exportItemReport")
|
|
|
- public void exportItemReport(HttpServletRequest request, HttpServletResponse response, Long userId, String startDate, String endDate, String shopId, Long itemId, String itemTitle) throws IOException, ParseException {
|
|
|
+ public void exportItemReport(HttpServletRequest request, HttpServletResponse response, Long userId, String startDate, String endDate, String shopId, Long itemId, String itemTitle, Integer itemType) throws IOException, ParseException {
|
|
|
Map<String, Object> requestMap = new HashMap<>();
|
|
|
|
|
|
if (Check.isNull(userId)) {
|
|
@@ -316,16 +376,26 @@ public class KwaixiaodianItemGetController extends BaseController {
|
|
|
return;
|
|
|
}
|
|
|
requestMap.put("companyId", companyId);
|
|
|
- } else if ("industry_sale_manager".equals(roleId) || "industry_courtship_manager".equals(roleId) || "industry_purchase_manager".equals(roleId)) { // 经理角色查看部门下所有成员数据
|
|
|
+ } else if ("industry_sale_manager".equals(roleId)) { // 销售经理角色查看部门下所有成员数据
|
|
|
List<Long> userIds = kwaixiaodianItemGetService.getUserIds(userId);
|
|
|
if (Check.isNull(userIds)) {
|
|
|
return;
|
|
|
}
|
|
|
requestMap.put("userIds", userIds);
|
|
|
- } else if ("industry_sale".equals(roleId) || "industry_purchase".equals(roleId) || "industry_courtship".equals(roleId)) { // 销售 采购 招商 查看自己的数据
|
|
|
+ } else if ("industry_sale".equals(roleId)) { // 销售 查看自己的数据
|
|
|
List<Long> userIds = new ArrayList<>();
|
|
|
userIds.add(userId);
|
|
|
requestMap.put("userIds", userIds);
|
|
|
+ } else if ("industry_courtship_manager".equals(roleId) || "industry_purchase_manager".equals(roleId)) { // 招商、采购经理角色查看部门下所有成员数据
|
|
|
+ List<Long> courtshipPurchaseIds = kwaixiaodianItemGetService.getUserIds(userId);
|
|
|
+ if (Check.isNull(courtshipPurchaseIds)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ requestMap.put("courtshipPurchaseIds", courtshipPurchaseIds);
|
|
|
+ } else if ("industry_purchase".equals(roleId) || "industry_courtship".equals(roleId)) { // 采购 招商 查看自己的数据
|
|
|
+ List<Long> courtshipPurchaseIds = new ArrayList<>();
|
|
|
+ courtshipPurchaseIds.add(userId);
|
|
|
+ requestMap.put("courtshipPurchaseIds", courtshipPurchaseIds);
|
|
|
}
|
|
|
|
|
|
if (!Check.isNull(shopId)) {
|
|
@@ -338,6 +408,9 @@ public class KwaixiaodianItemGetController extends BaseController {
|
|
|
if (!Check.isNull(itemTitle)) {
|
|
|
requestMap.put("itemTitle", itemTitle);
|
|
|
}
|
|
|
+ if (!Check.isNull(itemType)) {
|
|
|
+ requestMap.put("itemType", itemType);
|
|
|
+ }
|
|
|
|
|
|
Long start = DateUtils.strDateToInt(startDate);
|
|
|
Long end = DateUtils.strDateToInt(endDate);
|
|
@@ -363,10 +436,12 @@ public class KwaixiaodianItemGetController extends BaseController {
|
|
|
export.add(data.getString("itemId"));
|
|
|
export.add(data.getString("itemTitle"));
|
|
|
export.add(data.getString("price"));
|
|
|
+ export.add(data.getString("itemType"));
|
|
|
export.add(data.getString("orderNum"));
|
|
|
export.add(data.getString("orderNumRate"));
|
|
|
export.add(data.getString("validOrderNum"));
|
|
|
export.add(data.getString("validRadio"));
|
|
|
+ export.add(data.getString("effOrderNum"));
|
|
|
export.add(data.getString("totalFee"));
|
|
|
export.add(data.getString("validTotalFee"));
|
|
|
export.add(data.getString("deliveryNum"));
|
|
@@ -374,11 +449,12 @@ public class KwaixiaodianItemGetController extends BaseController {
|
|
|
export.add(data.getString("notDeliveryNum"));
|
|
|
export.add(data.getString("expressFee"));
|
|
|
export.add(data.getString("userName"));
|
|
|
+ export.add(data.getString("courtshipPurchaseName"));
|
|
|
export.add(data.getString("itemPicUrl"));
|
|
|
exportList.add(export);
|
|
|
}
|
|
|
}
|
|
|
- String[] headers = {"商品ID", "商品标题", "商品价格", "单量", "单量环比", "有效单量", "有效率", "GVM", "有效GMV", "发货数", "发货率", "未发货数", "运费", "绑定人", "商品图片"};
|
|
|
+ String[] headers = {"商品ID", "商品标题", "商品价格", "类型", "单量", "单量环比", "有效单量", "有效率", "失效单量", "GVM", "有效GMV", "发货数", "发货率", "未发货数", "运费", "绑定人", "招商/采购", "商品图片"};
|
|
|
OutputStream os = response.getOutputStream();
|
|
|
ExportExcelUtils eeu = new ExportExcelUtils();
|
|
|
XSSFWorkbook workbook = new XSSFWorkbook();
|