GoodsController.java 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658
  1. package com.kmall.admin.controller;
  2. import com.alibaba.fastjson.JSON;
  3. import com.kmall.admin.dto.GoodsDto;
  4. import com.kmall.admin.dto.GoodsPanoramaDto;
  5. import com.kmall.admin.entity.GoodsEntity;
  6. import com.kmall.admin.entity.GoodsGalleryEntity;
  7. import com.kmall.admin.entity.SysOssEntity;
  8. import com.kmall.admin.service.*;
  9. import com.kmall.admin.utils.ParamUtils;
  10. import com.kmall.admin.utils.ShiroUtils;
  11. import com.kmall.common.constant.Dict;
  12. import com.kmall.common.constant.JxlsXmlTemplateName;
  13. import com.kmall.admin.fromcomm.entity.SysUserEntity;
  14. import com.kmall.common.fileserver.util.FileManager;
  15. import com.kmall.common.utils.*;
  16. import com.kmall.common.utils.excel.ExcelExport;
  17. import com.kmall.common.utils.excel.ExcelUtil;
  18. import org.apache.commons.fileupload.FileItem;
  19. import org.apache.commons.fileupload.FileItemFactory;
  20. import org.apache.commons.fileupload.disk.DiskFileItemFactory;
  21. import org.apache.commons.lang3.StringUtils;
  22. import org.apache.shiro.authz.annotation.RequiresPermissions;
  23. import org.apache.tools.zip.ZipEntry;
  24. import org.apache.tools.zip.ZipFile;
  25. import org.springframework.beans.factory.annotation.Autowired;
  26. import org.springframework.web.bind.annotation.*;
  27. import org.springframework.web.multipart.MultipartFile;
  28. import org.springframework.web.multipart.commons.CommonsMultipartFile;
  29. import javax.servlet.http.HttpServletRequest;
  30. import javax.servlet.http.HttpServletResponse;
  31. import java.io.*;
  32. import java.util.*;
  33. /**
  34. * Controller
  35. *
  36. * @author Scott
  37. * @email
  38. * @date 2017-08-21 21:19:49
  39. */
  40. @RestController
  41. @RequestMapping("goods")
  42. public class GoodsController {
  43. @Autowired
  44. private GoodsService goodsService;
  45. @Autowired
  46. private GoodsGalleryService goodsGalleryService;
  47. @Autowired
  48. private OfflineCartService offlineCartService;
  49. @Autowired
  50. private ExcelUtil excelUtil;
  51. @Autowired
  52. private StoreService storeService;
  53. @Autowired
  54. private SysOssService sysOssService;
  55. /**
  56. * 查看列表
  57. */
  58. @RequestMapping("/list")
  59. @RequiresPermissions("goods:list")
  60. public R list(@RequestParam Map<String, Object> params) {
  61. ParamUtils.setQueryPowerByRoleType(params, "storeKey", "merchSn", "thirdPartyMerchCode");
  62. // ParamUtils.setName(params, "name");
  63. String lastSaleTime = (String) params.get("lastSaleTime");
  64. if(org.apache.commons.lang.StringUtils.isNotEmpty(lastSaleTime)) {
  65. try {
  66. lastSaleTime = new String(lastSaleTime.getBytes("iso-8859-1"), "utf-8");
  67. } catch (Exception e) {
  68. e.printStackTrace();
  69. }
  70. lastSaleTime = DateUtils.getDate(lastSaleTime);
  71. params.put("lastSaleTime", lastSaleTime + " 00:00:00");
  72. }
  73. //查询列表数据
  74. Query query = new Query(params);
  75. query.put("isDelete", 0);
  76. List<GoodsEntity> goodsList = goodsService.queryList(query);
  77. int total = goodsService.queryTotal(query);
  78. PageUtils pageUtil = new PageUtils(goodsList, total, query.getLimit(), query.getPage());
  79. return R.ok().put("page", pageUtil);
  80. }
  81. /**
  82. * 查看信息
  83. */
  84. @RequestMapping("/info/{id}")
  85. @RequiresPermissions("goods:info")
  86. public R info(@PathVariable("id") Integer id) {
  87. GoodsEntity goods = goodsService.queryObject(id);
  88. if(goods != null) {
  89. GoodsGalleryEntity goodsGalleryEntity =goodsGalleryService.queryVideoObjectByGoodId(goods.getId());
  90. if(goodsGalleryEntity != null){
  91. goods.setVideoUrl(goodsGalleryEntity.getImgUrl());
  92. }
  93. }
  94. return R.ok().put("goods", goods);
  95. }
  96. /**
  97. * 查看信息
  98. */
  99. @RequestMapping("/infoByQuery")
  100. public R infoByQuery(@RequestParam Map<String, Object> params) {
  101. ParamUtils.setQueryPowerByRoleType(params, "storeKey", "merchSn", "thirdPartyMerchCode");
  102. ParamUtils.setName(params, "name");
  103. //查询列表数据
  104. Query query = new Query(params);
  105. query.put("isDelete", 0);
  106. List<GoodsEntity> goodsList = goodsService.queryList(query);
  107. if(goodsList != null && goodsList.size() != 0) {
  108. return R.ok().put("goods", goodsList.get(0));
  109. }
  110. return R.ok().put("goods", new GoodsEntity());
  111. }
  112. /**
  113. * 保存
  114. */
  115. @RequestMapping("/save")
  116. @RequiresPermissions("goods:save")
  117. public R save(@RequestBody GoodsEntity goods) {
  118. goodsService.save(goods);
  119. return R.ok();
  120. }
  121. /**
  122. * 修改
  123. */
  124. @RequestMapping("/update")
  125. @RequiresPermissions("goods:update")
  126. public R update(@RequestBody GoodsEntity goods) {
  127. goodsService.update(goods);
  128. return R.ok();
  129. }
  130. /**
  131. * 删除
  132. */
  133. @RequestMapping("/delete")
  134. @RequiresPermissions("goods:delete")
  135. public R delete(@RequestBody Integer[] ids) {
  136. goodsService.deleteBatch(ids);
  137. return R.ok();
  138. }
  139. /**
  140. * 查看所有列表
  141. */
  142. @RequestMapping("/queryAll")
  143. public R queryAll(@RequestParam Map<String, Object> params) {
  144. ParamUtils.setQueryPowerByRoleType(params, "storeKey", "merchSn", "thirdPartyMerchCode");
  145. params.put("isDelete", Integer.parseInt(Dict.isDelete.item_0.getItem()));
  146. params.put("isOnSale", Integer.parseInt(Dict.isOnSale.item_1.getItem()));
  147. List<GoodsEntity> list = goodsService.queryList(params);
  148. return R.ok().put("list", list);
  149. }
  150. /**
  151. * 商品回收站
  152. *
  153. * @param params
  154. * @return
  155. */
  156. @RequestMapping("/historyList")
  157. public R historyList(@RequestParam Map<String, Object> params) {
  158. ParamUtils.setQueryPowerByRoleType(params, "storeKey", "merchSn", "thirdPartyMerchCode");
  159. //查询列表数据
  160. Query query = new Query(params);
  161. query.put("isDelete", 1);
  162. List<GoodsEntity> goodsList = goodsService.queryList(query);
  163. int total = goodsService.queryTotal(query);
  164. PageUtils pageUtil = new PageUtils(goodsList, total, query.getLimit(), query.getPage());
  165. return R.ok().put("page", pageUtil);
  166. }
  167. /**
  168. * 商品从回收站恢复
  169. */
  170. @RequestMapping("/back")
  171. @RequiresPermissions("goods:back")
  172. public R back(@RequestBody Integer[] ids) {
  173. goodsService.back(ids);
  174. return R.ok();
  175. }
  176. /**
  177. * 总计
  178. */
  179. @RequestMapping("/queryTotal")
  180. public R queryTotal(@RequestParam Map<String, Object> params) {
  181. ParamUtils.setQueryPowerByRoleType(params, "storeKey", "merchSn", "thirdPartyMerchCode");
  182. params.put("isDelete", 0);
  183. int sum = goodsService.queryTotal(params);
  184. return R.ok().put("goodsSum", sum);
  185. }
  186. /**
  187. * 上架
  188. */
  189. @RequestMapping("/enSale")
  190. public R enSale(@RequestBody Integer id) {
  191. goodsService.enSale(id);
  192. return R.ok();
  193. }
  194. /**
  195. * 上架
  196. */
  197. @RequestMapping("/enSaleBatch")
  198. public R enSaleBatch(@RequestBody Integer[] ids) {
  199. goodsService.enSaleBatch(ids);
  200. return R.ok();
  201. }
  202. /**
  203. * 下架
  204. */
  205. @RequestMapping("/unSale")
  206. public R unSale(@RequestBody Integer id) {
  207. goodsService.unSale(id);
  208. return R.ok();
  209. }
  210. /**
  211. * 下架
  212. */
  213. @RequestMapping("/unSaleBatch")
  214. public R unSaleBatch(@RequestBody Integer[] ids) {
  215. goodsService.unSaleBatch(ids);
  216. return R.ok();
  217. }
  218. /**
  219. * 上传文件
  220. */
  221. @RequestMapping("/upload")
  222. @ResponseBody
  223. public R upload(@RequestParam("file") MultipartFile file) {
  224. List<GoodsDto> goodsDtoList = new ArrayList<>();//商品信息
  225. try {
  226. Map<String, Object> beans = new HashMap<String, Object>();
  227. beans.put("GoodsDtoList", goodsDtoList);
  228. if (file.isEmpty()) {
  229. return R.error("文件不能为空!");
  230. }
  231. excelUtil.readExcel(JxlsXmlTemplateName.GOODS_DTO_LIST, beans, file.getInputStream());
  232. } catch (Exception e) {
  233. e.printStackTrace();
  234. return R.error("导入失败!");
  235. }
  236. goodsService.uploadExcel(goodsDtoList,Integer.parseInt(Dict.exportDataType.item_1.getItem()));
  237. //上传文件
  238. return R.ok();
  239. }
  240. /**
  241. * 上传文件
  242. */
  243. @RequestMapping("/generalGoodsUpload")
  244. @ResponseBody
  245. public R generalGoodsUpload(@RequestParam("file") MultipartFile file) {
  246. List<GoodsDto> generalGoodsDtoList = new ArrayList<>();//商品信息
  247. try {
  248. Map<String, Object> beans = new HashMap<String, Object>();
  249. beans.put("GeneralGoodsDtoList", generalGoodsDtoList);
  250. if (file.isEmpty()) {
  251. return R.error("文件不能为空!");
  252. }
  253. excelUtil.readExcel(JxlsXmlTemplateName.GENERAL_GOODS_DTO_LIST, beans, file.getInputStream());
  254. } catch (Exception e) {
  255. e.printStackTrace();
  256. return R.error("导入失败!");
  257. }
  258. goodsService.uploadExcel(generalGoodsDtoList,Integer.parseInt(Dict.exportDataType.item_2.getItem()));
  259. //上传文件
  260. return R.ok();
  261. }
  262. @RequestMapping("/generalGoodsImgUploadByZip")
  263. @ResponseBody
  264. public R batchAddImgByZip(@RequestParam("file") MultipartFile file) {
  265. //上传文件
  266. batchAdd(file,2);
  267. return R.ok();
  268. }
  269. @RequestMapping("/generalGoodsImgUpload")
  270. @ResponseBody
  271. public R batchAddImg(@RequestParam("file") MultipartFile file) {
  272. //上传文件
  273. batchAdd(file,1);
  274. return R.ok();
  275. }
  276. private Map<String, Object> batchAdd(MultipartFile file, int type) {
  277. /*
  278. *创建临时文件夹
  279. * 解压文件
  280. */
  281. String fileName = file.getOriginalFilename();
  282. String path = "d:/zip/";
  283. File dir = new File(path);
  284. dir.mkdirs();
  285. String filePath = "d:/test/";
  286. File fileDir = new File(filePath);
  287. fileDir.mkdirs();
  288. File saveFile = new File(fileDir, fileName);//将压缩包解析到指定位置
  289. List<String>list = new ArrayList<>();
  290. try {
  291. file.transferTo(saveFile);
  292. String newFilePath = filePath + fileName;
  293. File zipFile = new File(newFilePath);
  294. unZipFiles(zipFile, path,list,type);//解压文件,获取文件路径
  295. System.out.println(JSON.toJSONString(list));
  296. } catch (Exception e) {
  297. e.printStackTrace();
  298. System.out.println("解压执行失败");
  299. }
  300. //程序结束时,删除临时文件
  301. deleteFiles(filePath);//删除压缩包文件夹
  302. deleteFiles(path);//删除解压文件夹**
  303. Map<String, Object> jsonMap = new HashMap<String, Object>();
  304. jsonMap.put("ret",list);
  305. return jsonMap;
  306. }
  307. public void unZipFiles(File srcFile, String destDirPath, List<String> list, int type) throws RuntimeException {
  308. long start = System.currentTimeMillis();
  309. // 判断源文件是否存在
  310. if (!srcFile.exists()) {
  311. throw new RuntimeException(srcFile.getPath() + "所指文件不存在");
  312. }
  313. // 开始解压
  314. ZipFile zipFile = null;
  315. try {
  316. zipFile = new ZipFile(srcFile);
  317. Enumeration<?> entries = zipFile.getEntries();
  318. while (entries.hasMoreElements()) {
  319. ZipEntry entry = (ZipEntry) entries.nextElement();
  320. System.out.println("解压" + entry.getName());
  321. // 如果是文件夹,就创建个文件夹
  322. if (entry.isDirectory()) {
  323. String dirPath = destDirPath + "/" + entry.getName();
  324. File dir = new File(dirPath);
  325. dir.mkdirs();
  326. } else {
  327. // 如果是文件,就先创建一个文件,然后用io流把内容copy过去
  328. File targetFile = new File(destDirPath + "/" + entry.getName());
  329. // 保证这个文件的父文件夹必须要存在
  330. if(!targetFile.getParentFile().exists()){
  331. }
  332. targetFile.createNewFile();
  333. // 将压缩文件内容写入到这个文件中
  334. InputStream is = zipFile.getInputStream(entry);
  335. FileOutputStream fos = new FileOutputStream(targetFile);
  336. int len;
  337. byte[] buf = new byte[1024];
  338. while ((len = is.read(buf)) != -1) {
  339. fos.write(buf, 0, len);
  340. }
  341. MultipartFile mulFileByPath = getMulFileByPath(destDirPath + "/" + entry.getName());
  342. //上传文件
  343. String url = FileManager.upload(mulFileByPath);
  344. list.add(url);
  345. if(type == 1){
  346. String sku = entry.getName().split("/")[2].split("\\.")[0];
  347. GoodsEntity goodsEntity = goodsService.queryBySku(sku);
  348. goodsEntity.setPrimaryPicUrl(url);
  349. goodsEntity.setListPicUrl(url);
  350. goodsService.updateForImgUrl(goodsEntity);
  351. }else if(type == 2){
  352. String barCode = entry.getName().split("/")[1];
  353. GoodsEntity goodsEntity = goodsService.queryByBarcode(barCode);
  354. goodsEntity.setPrimaryPicUrl(url);
  355. goodsEntity.setListPicUrl(url);
  356. goodsService.updateForImgUrl(goodsEntity);
  357. }
  358. //保存文件信息
  359. SysOssEntity ossEntity = new SysOssEntity();
  360. ossEntity.setUrl(url);
  361. ossEntity.setCreateDate(new Date());
  362. sysOssService.save(ossEntity);
  363. // 关流顺序,先打开的后关闭
  364. fos.close();
  365. is.close();
  366. }
  367. }
  368. long end = System.currentTimeMillis();
  369. System.out.println("解压完成,耗时:" + (end - start) +" ms");
  370. } catch (Exception e) {
  371. throw new RuntimeException("unzip error from ZipUtils", e);
  372. } finally {
  373. if(zipFile != null){
  374. try {
  375. zipFile.close();
  376. } catch (IOException e) {
  377. e.printStackTrace();
  378. }
  379. }
  380. }
  381. }
  382. private static MultipartFile getMulFileByPath(String picPath) {
  383. FileItem fileItem = createFileItem(picPath);
  384. MultipartFile mfile = new CommonsMultipartFile(fileItem);
  385. return mfile;
  386. }
  387. private static FileItem createFileItem(String filePath)
  388. {
  389. FileItemFactory factory = new DiskFileItemFactory(16, null);
  390. String textFieldName = "textField";
  391. int num = filePath.lastIndexOf(".");
  392. String extFile = filePath.substring(num);
  393. FileItem item = factory.createItem(textFieldName, "text/plain", true,
  394. "MyFileName" + extFile);
  395. File newfile = new File(filePath);
  396. int bytesRead = 0;
  397. byte[] buffer = new byte[8192];
  398. try
  399. {
  400. FileInputStream fis = new FileInputStream(newfile);
  401. OutputStream os = item.getOutputStream();
  402. while ((bytesRead = fis.read(buffer, 0, 8192))
  403. != -1)
  404. {
  405. os.write(buffer, 0, bytesRead);
  406. }
  407. os.close();
  408. fis.close();
  409. }
  410. catch (IOException e)
  411. {
  412. e.printStackTrace();
  413. }
  414. return item;
  415. }
  416. public void deleteFiles(String filePath) {
  417. File file = new File(filePath);
  418. if ((!file.exists()) || (!file.isDirectory())) {
  419. System.out.println("file not exist");
  420. return;
  421. }
  422. String[] tempList = file.list();
  423. File temp = null;
  424. for (int i = 0; i < tempList.length; i++) {
  425. if (filePath.endsWith(File.separator)) {
  426. temp = new File(filePath + tempList[i]);
  427. }
  428. else {
  429. temp = new File(filePath + File.separator + tempList[i]);
  430. }
  431. if (temp.isFile()) {
  432. temp.delete();
  433. }
  434. if (temp.isDirectory()) {
  435. this.deleteFiles(filePath + "/" + tempList[i]);
  436. }
  437. }
  438. // 空文件的删除
  439. file.delete();
  440. }
  441. /*@RequestMapping("/scannInfo")
  442. @RequiresPermissions("goods:scannInfo")
  443. public R scannInfo(@RequestParam Map<String, Object> params) {
  444. String goodsSn = (String)params.get("goodsSn");
  445. GoodsEntity goods = goodsService.queryObjectByGoodsSnAndBizType(goodsSn);
  446. if(goods == null) {
  447. return R.error("商品信息不存在");
  448. }
  449. List<OfflineCartEntity> cartEntityList = offlineCartService.offlineGoodsCart(goods);
  450. return R.ok().put("cartEntityList", cartEntityList);
  451. }*/
  452. @RequestMapping("/scannInfo/{prodBarcode}")
  453. @RequiresPermissions("goods:scannInfo")
  454. public R scannInfo(@PathVariable("prodBarcode")String prodBarcode) {
  455. SysUserEntity user = ShiroUtils.getUserEntity();
  456. if(user == null) {
  457. return R.error("用户登录超时,请重新登录");
  458. }
  459. if (!user.getRoleType().equalsIgnoreCase("2")) {
  460. return R.error("该操作只允许店员账户操作");
  461. }
  462. GoodsEntity goods = goodsService.queryObjectByProdBarcodeAndBizType(prodBarcode, user.getStoreId());
  463. if(goods == null) {
  464. return R.error("商品信息不存在");
  465. }
  466. return R.ok().put("goods", goods);
  467. }
  468. @RequestMapping("/details/{prodBarcode}/{storeId}")
  469. // @RequiresPermissions("goods:details") http://127.0.0.1:8080/goods/details/11111
  470. public R details(@PathVariable("prodBarcode")String prodBarcode,@PathVariable("storeId")String storeId) {
  471. SysUserEntity user = ShiroUtils.getUserEntity();
  472. if(user == null) {
  473. return R.error("用户登录超时,请重新登录");
  474. }
  475. if (!user.getRoleType().equalsIgnoreCase("2")) {
  476. return R.error("该操作只允许店员账户操作");
  477. }
  478. Map<String,Object> map = goodsService.calculateGoodsDetail(prodBarcode,storeId);
  479. if(map == null){
  480. return R.error("商品信息不存在");
  481. }
  482. return R.ok().put("goodsDetails", map.get("goods")).put("map",map);
  483. }
  484. /**
  485. * 根据商品编码或者条码查询商品信息(17.商品全景图)
  486. * @param keyword
  487. * @return
  488. */
  489. @GetMapping("/search/{keyword}")
  490. public R searchByKeyword(@PathVariable("keyword") String keyword){
  491. if (keyword == null || "".equals(keyword)){
  492. return R.error("请输入商品编码或者条码!");
  493. }
  494. GoodsPanoramaDto goodsPanoramaDto = goodsService.searchGoodsPanoramaDtoByKeyword(keyword);
  495. //GoodsEntity goods = goodsService.searchGoodsByKeyword(keyword);
  496. if (goodsPanoramaDto == null || "".equals(goodsPanoramaDto)) {
  497. return R.error("没有该商品!");
  498. }
  499. return R.ok().put("goodsPanoramaDto",goodsPanoramaDto);
  500. }
  501. /**
  502. * 所有商品模块导出
  503. * @param params 查询参数
  504. * @param response
  505. * @param request
  506. * @return
  507. */
  508. @RequiresPermissions("goods:export")
  509. @RequestMapping(value = "export")
  510. public R export(@RequestParam Map<String, Object> params, HttpServletResponse response, HttpServletRequest request) {
  511. ParamUtils.setQueryPowerByRoleType(params, "storeId", "merchSn", "thirdPartyMerchCode");
  512. params.put("isDelete", 0);
  513. String lastSaleTime = (String) params.get("lastSaleTime");
  514. if(org.apache.commons.lang.StringUtils.isNotEmpty(lastSaleTime)) {
  515. try {
  516. lastSaleTime = new String(lastSaleTime.getBytes("iso-8859-1"), "utf-8");
  517. } catch (Exception e) {
  518. e.printStackTrace();
  519. }
  520. lastSaleTime = DateUtils.getDate(lastSaleTime);
  521. params.put("lastSaleTime", lastSaleTime + " 00:00:00");
  522. }
  523. // 根据条件查询出列表
  524. List<GoodsEntity> goodsList = goodsService.queryExportList(params);
  525. ExcelExport ee = new ExcelExport("所有商品信息");
  526. String[] header = new String[]{"商户名称","第三方商户编号","商品编码","SKU","PLU","商品名称","商品英文名称","产品条码","货品业务类型","库存是否共享",
  527. "商品库存","日常价","成本价","是否上架","是否热销","录入日期","商品单位","商品税率","产品品牌","海关备案编号","计量单位","海关商品编码","国检规格型号",
  528. "原产国","海关申报要素","毛重(kg)","净重(kg)"};
  529. List<Map<String, Object>> list = new ArrayList<>();
  530. if (goodsList !=null && goodsList.size()>0){
  531. for (GoodsEntity goodsEntity : goodsList) {
  532. LinkedHashMap<String, Object> map = new LinkedHashMap<>();
  533. map.put("MerchName",goodsEntity.getMerchName());
  534. map.put("ThirdPartyMerchCode",goodsEntity.getThirdPartyMerchCode());
  535. map.put("GoodsSn",goodsEntity.getGoodsSn());
  536. map.put("Sku",goodsEntity.getSku());
  537. map.put("Plu",goodsEntity.getPlu());
  538. map.put("Name",goodsEntity.getName());
  539. map.put("EnglishName",goodsEntity.getEnglishName());
  540. String goodsBizType = goodsEntity.getGoodsBizType();
  541. Integer isStockShare = 0;
  542. if (goodsEntity.getIsStockShare()!=null){
  543. isStockShare = Integer.parseInt(goodsEntity.getIsStockShare());
  544. }
  545. map.put("ProdBarcode",goodsEntity.getProdBarcode());
  546. map.put("GoodsBizType",StringUtils.isEmpty(goodsBizType)?"":Dict.orderBizType.valueOf("item_"+goodsBizType).getItemName());
  547. map.put("IsStockShare",isStockShare==0?"否":"是");
  548. map.put("GoodsNumber",goodsEntity.getGoodsNumber());
  549. map.put("DailyPrice",goodsEntity.getDailyPrice());
  550. map.put("CostPrice",goodsEntity.getCostPrice());
  551. map.put("IsOnSale",goodsEntity.getIsOnSale()==0?"否":"是");
  552. map.put("IsHot",goodsEntity.getIsHot()==0?"否":"是");
  553. map.put("AddTime",goodsEntity.getAddTime());
  554. map.put("GoodsUnit",goodsEntity.getGoodsUnit());
  555. map.put("GoodsRate",goodsEntity.getGoodsRate());
  556. map.put("Brand",goodsEntity.getBrand());
  557. map.put("CusRecCode",goodsEntity.getCusRecCode());
  558. map.put("UnitCode",goodsEntity.getUnitCode());
  559. map.put("CusGoodsCode",goodsEntity.getCusGoodsCode());
  560. map.put("CiqProdModel",goodsEntity.getCiqProdModel());
  561. map.put("OriCntName",goodsEntity.getOriCntName());
  562. map.put("CusDeclEle",goodsEntity.getCusDeclEle());
  563. map.put("GrossWeight",goodsEntity.getGrossWeight());
  564. map.put("NetWeight",goodsEntity.getNetWeight());
  565. list.add(map);
  566. }
  567. }
  568. ee.addSheetByMap("所有商品信息", list, header);
  569. ee.export(response);
  570. return R.ok();
  571. }
  572. }