KwaixiaodianItemGetController.java 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546
  1. package com.ruixuan.isc.controller;
  2. import com.alibaba.fastjson.JSONObject;
  3. import com.github.pagehelper.PageInfo;
  4. import com.ruixuan.common.constant.HttpStatus;
  5. import com.ruixuan.common.core.controller.BaseController;
  6. import com.ruixuan.common.core.domain.AjaxResult;
  7. import com.ruixuan.common.core.domain.entity.SysUser;
  8. import com.ruixuan.common.core.page.TableDataInfo;
  9. import com.ruixuan.common.utils.Check;
  10. import com.ruixuan.common.utils.DateUtils;
  11. import com.ruixuan.data.utils.ExportExcelUtils;
  12. import com.ruixuan.isc.entity.KuaishouAccessToken;
  13. import com.ruixuan.isc.entity.KuaishouRewardBaseInfo;
  14. import com.ruixuan.isc.entity.KwaixiaodianItemGet;
  15. import com.ruixuan.isc.service.IAccessTokenService;
  16. import com.ruixuan.isc.service.IKwaixiaodianItemGetService;
  17. import com.ruixuan.isc.service.IKwaixiaodianOrderCursorListService;
  18. import com.ruixuan.system.service.ISysDeptService;
  19. import com.ruixuan.system.service.ISysRoleService;
  20. import com.ruixuan.system.service.ISysUserService;
  21. import io.swagger.annotations.Api;
  22. import io.swagger.annotations.ApiOperation;
  23. import io.swagger.annotations.ApiParam;
  24. import io.swagger.models.auth.In;
  25. import lombok.extern.slf4j.Slf4j;
  26. import org.apache.poi.xssf.usermodel.XSSFWorkbook;
  27. import org.springframework.beans.factory.annotation.Autowired;
  28. import org.springframework.web.bind.annotation.*;
  29. import javax.servlet.http.HttpServletRequest;
  30. import javax.servlet.http.HttpServletResponse;
  31. import java.io.IOException;
  32. import java.io.OutputStream;
  33. import java.io.UnsupportedEncodingException;
  34. import java.math.BigDecimal;
  35. import java.text.ParseException;
  36. import java.text.SimpleDateFormat;
  37. import java.util.*;
  38. /**
  39. * kwaixiaodian商品详情Controller
  40. *
  41. * @date 2024-10-28
  42. */
  43. @Api(tags = "Kwaixiaodian")
  44. @RestController
  45. @RequestMapping("/kwaixiaodian/item")
  46. @Slf4j
  47. public class KwaixiaodianItemGetController extends BaseController {
  48. @Autowired
  49. private IKwaixiaodianItemGetService kwaixiaodianItemGetService;
  50. @Autowired
  51. private IKwaixiaodianOrderCursorListService orderCursorListService;
  52. @Autowired
  53. private IAccessTokenService accessTokenService;
  54. @Autowired
  55. private ISysRoleService sysRoleService;
  56. @Autowired
  57. private ISysDeptService sysDeptService;
  58. @Autowired
  59. private ISysUserService sysUserService;
  60. @GetMapping(value = "/{id}")
  61. public AjaxResult getInfo(@PathVariable("id") Long id)
  62. {
  63. return AjaxResult.success(kwaixiaodianItemGetService.selectKwaixiaodianItemGetById(id));
  64. }
  65. @PutMapping
  66. public AjaxResult edit(@RequestBody KwaixiaodianItemGet kwaixiaodianItemGet)
  67. {
  68. return toAjax(kwaixiaodianItemGetService.updateKwaixiaodianItemGet(kwaixiaodianItemGet));
  69. }
  70. @GetMapping("/list")
  71. public TableDataInfo list(Long itemId, String title, Integer itemType, Long userId) {
  72. TableDataInfo rspData = new TableDataInfo();
  73. try {
  74. if (Check.isNull(userId)) {
  75. throw new Exception("请传入用户ID");
  76. }
  77. Map<String, Object> requestMap = new HashMap<>();
  78. String roleId = sysRoleService.getRoleBYUserId(userId);
  79. if ("admin".equals(roleId)) { // 管理员查看所有
  80. } else if ("industry_admin".equals(roleId)) { // 供应链管理员查看所属公司
  81. Long companyId = kwaixiaodianItemGetService.getCompanyId(userId);
  82. if (Check.isNull(companyId)) {
  83. throw new Exception("此用户未查询到归属公司");
  84. }
  85. requestMap.put("companyId", companyId);
  86. } else if ("industry_sale_manager".equals(roleId) || "industry_courtship_manager".equals(roleId) || "industry_purchase_manager".equals(roleId)) { // 经理角色查看部门下所有成员数据
  87. List<Long> userIds = kwaixiaodianItemGetService.getUserIds(userId);
  88. if (Check.isNull(userIds)) {
  89. throw new Exception("此用户未查询到部门成员信息");
  90. }
  91. requestMap.put("userIds", userIds);
  92. } else if ("industry_sale".equals(roleId) || "industry_purchase".equals(roleId) || "industry_courtship".equals(roleId)) { // 销售 采购 招商 查看自己的数据
  93. List<Long> userIds = new ArrayList<>();
  94. userIds.add(userId);
  95. requestMap.put("userIds", userIds);
  96. }
  97. if (!Check.isNull(itemId)) {
  98. requestMap.put("itemId", itemId);
  99. }
  100. if (!Check.isNull(title)) {
  101. requestMap.put("title", title);
  102. }
  103. if (!Check.isNull(itemType)) {
  104. requestMap.put("itemType", itemType);
  105. }
  106. startPage();
  107. List<KwaixiaodianItemGet> list = kwaixiaodianItemGetService.getItemList(requestMap);
  108. rspData.setCode(HttpStatus.SUCCESS);
  109. rspData.setMsg("查询成功");
  110. rspData.setRows(list);
  111. rspData.setTotal(new PageInfo(list).getTotal());
  112. } catch (Exception e) {
  113. e.printStackTrace();
  114. rspData.setCode(HttpStatus.ERROR);
  115. rspData.setMsg(e.getMessage());
  116. }
  117. return rspData;
  118. }
  119. @GetMapping("/getShopList")
  120. public JSONObject getShopList(Long userId) {
  121. JSONObject returnJson = new JSONObject();
  122. try {
  123. if (Check.isNull(userId)) {
  124. throw new Exception("请传入用户ID");
  125. }
  126. String roleId = sysRoleService.getRoleBYUserId(userId);
  127. Long companyId = null;
  128. if ("admin".equals(roleId)) { // 管理员查看所有
  129. companyId = null;
  130. } else {
  131. companyId = kwaixiaodianItemGetService.getCompanyId(userId);
  132. }
  133. List<JSONObject> shopList = kwaixiaodianItemGetService.getShopList(companyId);
  134. returnJson.put("code", 200);
  135. returnJson.put("success", true);
  136. returnJson.put("data", shopList);
  137. } catch (Exception e) {
  138. e.printStackTrace();
  139. returnJson.put("code", 500);
  140. returnJson.put("success", false);
  141. returnJson.put("message", e.getMessage());
  142. }
  143. return returnJson;
  144. }
  145. @GetMapping("/getCourtshipPurchaseIds")
  146. public JSONObject getCourtshipPurchaseIds(Long userId) {
  147. JSONObject returnJson = new JSONObject();
  148. try {
  149. if (Check.isNull(userId)) {
  150. throw new Exception("请传入用户ID");
  151. }
  152. Long companyId = kwaixiaodianItemGetService.getCompanyId(userId);
  153. List<JSONObject> userIds = kwaixiaodianItemGetService.getCourtshipPurchaseIds(companyId);
  154. returnJson.put("code", 200);
  155. returnJson.put("success", true);
  156. returnJson.put("data", userIds);
  157. } catch (Exception e) {
  158. e.printStackTrace();
  159. returnJson.put("code", 500);
  160. returnJson.put("success", false);
  161. returnJson.put("message", e.getMessage());
  162. }
  163. return returnJson;
  164. }
  165. /**
  166. * 获取商品详情(open.item.get)
  167. * https://open.kwaixiaodian.com/zone/new/docs/api?name=open.item.get&version=1
  168. */
  169. @PostMapping("/querykwaiItmInfo")
  170. @ApiOperation(value = "获kwai商品详情")
  171. public JSONObject querykwaiItmInfo(@RequestBody JSONObject requestJson) {
  172. JSONObject returnJson = new JSONObject();
  173. try {
  174. Long itemId = requestJson.getLong("itemId");
  175. if (Check.isNull(itemId)) {
  176. throw new Exception("未传入商品ID");
  177. }
  178. String shopId = requestJson.getString("shopId");
  179. if (Check.isNull(shopId)) {
  180. throw new Exception("未传入小店ID");
  181. }
  182. Long userId = requestJson.getLong("userId");
  183. if (Check.isNull(userId)) {
  184. throw new Exception("未传入用户ID");
  185. }
  186. Integer itemType = requestJson.getInteger("itemType");
  187. if (Check.isNull(itemType)) {
  188. throw new Exception("未选择选品方式");
  189. }
  190. Long courtshipPurchaseId = requestJson.getLong("courtshipPurchaseId");
  191. SysUser sysUser = sysUserService.selectUserById(userId);
  192. if (Check.isNull(sysUser)) {
  193. throw new Exception("用户信息为空");
  194. }
  195. KuaishouAccessToken token = accessTokenService.getKWaiAccessToken(shopId);
  196. if (Check.isNull(token)) {
  197. throw new Exception("未获取到授权信息,请联系管理员");
  198. }
  199. Long companyId = token.getCompanyId();
  200. Integer count = kwaixiaodianItemGetService.checkItem(companyId, itemId);
  201. if (count >= 1) {
  202. throw new Exception("此商品已绑定");
  203. }
  204. JSONObject jsonObject = kwaixiaodianItemGetService.querykwaiItmInfo(token, itemId, shopId, userId, sysUser.getNickName(), itemType, courtshipPurchaseId);
  205. if (jsonObject.getBoolean("success")) {
  206. returnJson.put("code", 200);
  207. returnJson.put("success", true);
  208. returnJson.put("message", "新增商品成功");
  209. } else {
  210. returnJson.put("code", 500);
  211. returnJson.put("success", false);
  212. returnJson.put("message", jsonObject.getString("message"));
  213. }
  214. } catch (Exception e) {
  215. e.printStackTrace();
  216. returnJson.put("code", 500);
  217. returnJson.put("success", false);
  218. returnJson.put("message", e.getMessage());
  219. }
  220. return returnJson;
  221. }
  222. @DeleteMapping("/{ids}")
  223. public AjaxResult remove(@PathVariable Long[] ids) {
  224. return toAjax(kwaixiaodianItemGetService.deleteById(ids));
  225. }
  226. @GetMapping("/queryItemReport")
  227. public TableDataInfo getDingPanMentorBusinessList(Long userId, String startDate, String endDate, String shopId, Long itemId, String itemTitle, Integer itemType) {
  228. TableDataInfo rspData = new TableDataInfo();
  229. try {
  230. Map<String, Object> requestMap = new HashMap<>();
  231. if (Check.isNull(userId)) {
  232. throw new Exception("请传入用户id");
  233. }
  234. if (Check.isNull(startDate)) {
  235. throw new Exception("请传入开始日期");
  236. }
  237. if (Check.isNull(endDate)) {
  238. throw new Exception("请传入结束日期");
  239. }
  240. String roleId = sysRoleService.getRoleBYUserId(userId);
  241. if ("admin".equals(roleId)) { // 管理员查看所有
  242. } else if ("industry_admin".equals(roleId)) { // 供应链管理员查看所属公司
  243. Long companyId = kwaixiaodianItemGetService.getCompanyId(userId);
  244. if (Check.isNull(companyId)) {
  245. throw new Exception("此用户未查询到归属公司");
  246. }
  247. requestMap.put("companyId", companyId);
  248. } else if ("industry_sale_manager".equals(roleId)) { // 销售经理角色查看部门下所有成员数据
  249. List<Long> userIds = kwaixiaodianItemGetService.getUserIds(userId);
  250. if (Check.isNull(userIds)) {
  251. throw new Exception("此用户未查询到部门成员信息");
  252. }
  253. requestMap.put("userIds", userIds);
  254. } else if ("industry_sale".equals(roleId)) { // 销售 查看自己的数据
  255. List<Long> userIds = new ArrayList<>();
  256. userIds.add(userId);
  257. requestMap.put("userIds", userIds);
  258. } else if ("industry_courtship_manager".equals(roleId) || "industry_purchase_manager".equals(roleId)) { // 招商、采购经理角色查看部门下所有成员数据
  259. List<Long> courtshipPurchaseIds = kwaixiaodianItemGetService.getUserIds(userId);
  260. if (Check.isNull(courtshipPurchaseIds)) {
  261. throw new Exception("此用户未查询到部门成员信息");
  262. }
  263. requestMap.put("courtshipPurchaseIds", courtshipPurchaseIds);
  264. } else if ("industry_purchase".equals(roleId) || "industry_courtship".equals(roleId)) { // 采购 招商 查看自己的数据
  265. List<Long> courtshipPurchaseIds = new ArrayList<>();
  266. courtshipPurchaseIds.add(userId);
  267. requestMap.put("courtshipPurchaseIds", courtshipPurchaseIds);
  268. }
  269. if (!Check.isNull(shopId)) {
  270. requestMap.put("shopId", shopId);
  271. }
  272. if (!Check.isNull(itemId)) {
  273. requestMap.put("itemId", itemId);
  274. }
  275. if (!Check.isNull(itemTitle)) {
  276. requestMap.put("itemTitle", itemTitle);
  277. }
  278. if (!Check.isNull(itemType)) {
  279. requestMap.put("itemType", itemType);
  280. }
  281. Long start = DateUtils.strDateToInt(startDate);
  282. Long end = DateUtils.strDateToInt(endDate);
  283. requestMap.put("start", start);
  284. requestMap.put("end", end);
  285. SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
  286. int differDay = DateUtils.differentDaysByMillisecond(simpleDateFormat.parse(startDate), simpleDateFormat.parse(endDate));
  287. String lastEndStr = DateUtils.getAnotherDay("yyyy-MM-dd", startDate, -1); // 上一时段结束日期
  288. String lastStartStr = DateUtils.getAnotherDay("yyyy-MM-dd", lastEndStr, -differDay); // 上一时段开始日期
  289. requestMap.put("lastEnd", DateUtils.strDateToInt(lastEndStr));
  290. requestMap.put("lastStart", DateUtils.strDateToInt(lastStartStr));
  291. Long nowDate = Long.valueOf(DateUtils.getNowDate("yyyyMMdd"));
  292. if (start.equals(nowDate) && end.equals(nowDate)) {
  293. Integer nowHour = DateUtils.getNowHour();
  294. requestMap.put("nowHour", nowHour);
  295. }
  296. startPage();
  297. List<JSONObject> data = orderCursorListService.queryItemReport(requestMap);
  298. rspData.setCode(HttpStatus.SUCCESS);
  299. rspData.setMsg("查询成功");
  300. rspData.setRows(data);
  301. rspData.setTotal(new PageInfo(data).getTotal());
  302. } catch (Exception e) {
  303. e.printStackTrace();
  304. rspData.setCode(HttpStatus.ERROR);
  305. rspData.setMsg(e.getMessage());
  306. }
  307. return rspData;
  308. }
  309. @GetMapping("/exportItemReport")
  310. public void exportItemReport(HttpServletRequest request, HttpServletResponse response, Long userId, String startDate, String endDate, String shopId, Long itemId, String itemTitle, Integer itemType) throws IOException, ParseException {
  311. Map<String, Object> requestMap = new HashMap<>();
  312. if (Check.isNull(userId)) {
  313. return;
  314. }
  315. if (Check.isNull(startDate)) {
  316. return;
  317. }
  318. if (Check.isNull(endDate)) {
  319. return;
  320. }
  321. String roleId = sysRoleService.getRoleBYUserId(userId);
  322. if ("admin".equals(roleId)) { // 管理员查看所有
  323. } else if ("industry_admin".equals(roleId)) { // 供应链管理员查看所属公司
  324. Long companyId = kwaixiaodianItemGetService.getCompanyId(userId);
  325. if (Check.isNull(companyId)) {
  326. return;
  327. }
  328. requestMap.put("companyId", companyId);
  329. } else if ("industry_sale_manager".equals(roleId)) { // 销售经理角色查看部门下所有成员数据
  330. List<Long> userIds = kwaixiaodianItemGetService.getUserIds(userId);
  331. if (Check.isNull(userIds)) {
  332. return;
  333. }
  334. requestMap.put("userIds", userIds);
  335. } else if ("industry_sale".equals(roleId)) { // 销售 查看自己的数据
  336. List<Long> userIds = new ArrayList<>();
  337. userIds.add(userId);
  338. requestMap.put("userIds", userIds);
  339. } else if ("industry_courtship_manager".equals(roleId) || "industry_purchase_manager".equals(roleId)) { // 招商、采购经理角色查看部门下所有成员数据
  340. List<Long> courtshipPurchaseIds = kwaixiaodianItemGetService.getUserIds(userId);
  341. if (Check.isNull(courtshipPurchaseIds)) {
  342. return;
  343. }
  344. requestMap.put("courtshipPurchaseIds", courtshipPurchaseIds);
  345. } else if ("industry_purchase".equals(roleId) || "industry_courtship".equals(roleId)) { // 采购 招商 查看自己的数据
  346. List<Long> courtshipPurchaseIds = new ArrayList<>();
  347. courtshipPurchaseIds.add(userId);
  348. requestMap.put("courtshipPurchaseIds", courtshipPurchaseIds);
  349. }
  350. if (!Check.isNull(shopId)) {
  351. requestMap.put("shopId", shopId);
  352. }
  353. if (!Check.isNull(itemId)) {
  354. requestMap.put("itemId", itemId);
  355. }
  356. if (!Check.isNull(itemTitle)) {
  357. requestMap.put("itemTitle", itemTitle);
  358. }
  359. if (!Check.isNull(itemType)) {
  360. requestMap.put("itemType", itemType);
  361. }
  362. Long start = DateUtils.strDateToInt(startDate);
  363. Long end = DateUtils.strDateToInt(endDate);
  364. requestMap.put("start", start);
  365. requestMap.put("end", end);
  366. SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
  367. int differDay = DateUtils.differentDaysByMillisecond(simpleDateFormat.parse(startDate), simpleDateFormat.parse(endDate));
  368. String lastEndStr = DateUtils.getAnotherDay("yyyy-MM-dd", startDate, -1); // 上一时段结束日期
  369. String lastStartStr = DateUtils.getAnotherDay("yyyy-MM-dd", lastEndStr, -differDay); // 上一时段开始日期
  370. requestMap.put("lastEnd", DateUtils.strDateToInt(lastEndStr));
  371. requestMap.put("lastStart", DateUtils.strDateToInt(lastStartStr));
  372. Long nowDate = Long.valueOf(DateUtils.getNowDate("yyyyMMdd"));
  373. if (start.equals(nowDate) && end.equals(nowDate)) {
  374. Integer nowHour = DateUtils.getNowHour();
  375. requestMap.put("nowHour", nowHour);
  376. }
  377. List<JSONObject> list = orderCursorListService.queryItemReport(requestMap);
  378. List<List<Object>> exportList = new ArrayList<>();
  379. if (!Check.isNull(list)) {
  380. for (int i = 0; i < list.size(); i++) {
  381. JSONObject data = list.get(i);
  382. List<Object> export = new ArrayList();
  383. export.add(data.getString("itemId"));
  384. export.add(data.getString("itemTitle"));
  385. export.add(data.getString("price"));
  386. export.add(data.getString("itemType"));
  387. export.add(data.getString("orderNum"));
  388. export.add(data.getString("orderNumRate"));
  389. export.add(data.getString("validOrderNum"));
  390. export.add(data.getString("validRadio"));
  391. export.add(data.getString("effOrderNum"));
  392. export.add(data.getString("totalFee"));
  393. export.add(data.getString("validTotalFee"));
  394. export.add(data.getString("deliveryNum"));
  395. export.add(data.getString("deliveryRate"));
  396. export.add(data.getString("notDeliveryNum"));
  397. export.add(data.getString("expressFee"));
  398. export.add(data.getString("userName"));
  399. export.add(data.getString("courtshipPurchaseName"));
  400. export.add(data.getString("itemPicUrl"));
  401. exportList.add(export);
  402. }
  403. }
  404. String[] headers = {"商品ID", "商品标题", "商品价格", "类型", "单量", "单量环比", "有效单量", "有效率", "失效单量", "GVM", "有效GMV", "发货数", "发货率", "未发货数", "运费", "绑定人", "招商/采购", "商品图片"};
  405. OutputStream os = response.getOutputStream();
  406. ExportExcelUtils eeu = new ExportExcelUtils();
  407. XSSFWorkbook workbook = new XSSFWorkbook();
  408. eeu.exportExcel(workbook, 0, "商品数据", headers, exportList);
  409. this.setResponseHeader(response, "商品数据.xls");
  410. try {
  411. workbook.write(os);
  412. } catch (IOException e) {
  413. e.printStackTrace();
  414. }
  415. os.flush();
  416. os.close();
  417. }
  418. @GetMapping("/querykwaiOrderList")
  419. @ApiOperation(value = "获kwai订单列表")
  420. public void querykwaiOrderList(@ApiParam("店铺ID") @RequestParam(value = "shopId", required = false) String shopId, @ApiParam("1按创建时间查找 2按更新时间查找") @RequestParam(value = "queryType", required = false) Integer queryType, @ApiParam("开始日期") @RequestParam(value = "beginDate", required = false) String beginDate, @ApiParam("结束日期(间隔不大于7天)") @RequestParam(value = "endDate", required = false) String endDate
  421. ) {
  422. try {
  423. orderCursorListService.querykwaiOrderList(shopId.trim(), queryType, beginDate, endDate, "");
  424. } catch (Exception e) {
  425. e.printStackTrace();
  426. }
  427. }
  428. @GetMapping("/queryNowdayKWaiOrderList")
  429. @ApiOperation(value = "获当天kwai订单")
  430. public void queryNowdayKWaiOrderList(@ApiParam("店铺ID") @RequestParam(value = "shopId", required = false) String shopId) {
  431. try {
  432. orderCursorListService.queryNowdayKWaiOrderList(shopId.trim(), "");
  433. } catch (Exception e) {
  434. e.printStackTrace();
  435. }
  436. }
  437. /**
  438. * 获取订单列表(open.order.cursor.list)
  439. * https://open.kwaixiaodian.com/zone/new/docs/api?name=open.order.cursor.list&version=1
  440. */
  441. @GetMapping("/querykwaiOrderListMonth")
  442. @ApiOperation(value = "获kwai订单列表月度数据")
  443. public void querykwaiOrderListMonth(@ApiParam("店铺ID") @RequestParam(value = "shopId", required = false) String shopId) {
  444. String date1 = DateUtils.getDate();
  445. String date0 = DateUtils.getSubtractTime(new Date(), 89);
  446. List<String> allDatesOfTwoTimes = DateUtils.getAllDatesOfTwoTimes(date0, date1);
  447. for (String date : allDatesOfTwoTimes) {
  448. orderCursorListService.querykwaiOrderList(shopId.trim(), 1, date, date, "");
  449. logger.info("shopId:{},日期:{} 执行-----ok", shopId, date);
  450. }
  451. }
  452. /**
  453. * 获取带货口碑分信息(open.score.master.get)
  454. * https://open.kwaixiaodian.com/zone/new/docs/api?name=open.score.master.get&version=1
  455. */
  456. @GetMapping("/queryMasterScore")
  457. @ApiOperation(value = "获取带货口碑分信息")
  458. public void queryMasterScore(@ApiParam("店铺ID") @RequestParam(value = "shopId", required = false) String shopId) {
  459. orderCursorListService.queryMaster(shopId);
  460. }
  461. /**
  462. * 获取店铺体验分信息(open.score.shop.get)
  463. * https://open.kwaixiaodian.com/zone/new/docs/api?name=open.score.master.get&version=1
  464. */
  465. @GetMapping("/queryShopScore")
  466. @ApiOperation(value = "获取店铺体验分信息")
  467. public void queryShopScore(@ApiParam("店铺ID") @RequestParam(value = "shopId", required = false) String shopId) {
  468. orderCursorListService.queryShop(shopId);
  469. }
  470. public void setResponseHeader(HttpServletResponse response, String fileName) {
  471. try {
  472. try {
  473. fileName = new String(fileName.getBytes(), "ISO8859-1");
  474. } catch (UnsupportedEncodingException e) {
  475. e.printStackTrace();
  476. }
  477. response.setContentType("application/octet-stream;charset=ISO8859-1");
  478. response.setHeader("Content-Disposition", "attachment;filename=" + fileName);
  479. response.addHeader("Pargam", "no-cache");
  480. response.addHeader("Cache-Control", "no-cache");
  481. } catch (Exception ex) {
  482. ex.printStackTrace();
  483. }
  484. }
  485. }