|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @RequestMapping(value = "/tag/page/auth") | 
|---|
|  |  |  | @ManagerAuth | 
|---|
|  |  |  | public R page(@RequestParam(defaultValue = "1") Integer curr, | 
|---|
|  |  |  | @RequestParam(defaultValue = "10") Integer limit, | 
|---|
|  |  |  | @RequestParam(required = false) String condition, | 
|---|
|  |  |  | @RequestParam(required = false) String timeRange) { | 
|---|
|  |  |  | public R page(@RequestParam(defaultValue = "1")Integer curr, | 
|---|
|  |  |  | @RequestParam(defaultValue = "10")Integer limit, | 
|---|
|  |  |  | @RequestParam(required = false)String orderByField, | 
|---|
|  |  |  | @RequestParam(required = false)String orderByType, | 
|---|
|  |  |  | @RequestParam Map<String, Object> param) { | 
|---|
|  |  |  | Long hostId = getHostId(); | 
|---|
|  |  |  | LambdaQueryWrapper<Tag> wrapper = new LambdaQueryWrapper<>(); | 
|---|
|  |  |  | if (!Cools.isEmpty(condition)) { | 
|---|
|  |  |  | wrapper.like(Tag::getId, condition); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (!Cools.isEmpty(timeRange)) { | 
|---|
|  |  |  | String[] range = timeRange.split(RANGE_TIME_LINK); | 
|---|
|  |  |  | wrapper.ge(Tag::getCreateTime, DateUtils.convert(range[0])); | 
|---|
|  |  |  | wrapper.le(Tag::getCreateTime, DateUtils.convert(range[1])); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return R.ok(tagService.page(new Page<>(curr, limit), wrapper)); | 
|---|
|  |  |  | wrapper.eq(Tag::getHostId, hostId); | 
|---|
|  |  |  | excludeTrash(param); | 
|---|
|  |  |  | return R.parse("0-操作成功").add(tagService.list(wrapper)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @RequestMapping(value = "/tag/add/auth") | 
|---|
|  |  |  | @ManagerAuth | 
|---|
|  |  |  | public R add(Tag tag) { | 
|---|
|  |  |  | tag.setHostId(getHostId()); | 
|---|
|  |  |  | tag.setStatus(1); | 
|---|
|  |  |  | tagService.save(tag); | 
|---|
|  |  |  | return R.ok(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | @PostMapping(value = "/tag/tree/auth") | 
|---|
|  |  |  | @ManagerAuth | 
|---|
|  |  |  | public R tree(@RequestParam(required = false, defaultValue = "") String condition) throws IOException, ClassNotFoundException { | 
|---|
|  |  |  | ArrayList<Map> tree = treeUtils.getTree(String.valueOf(getOriginTag().getId())); | 
|---|
|  |  |  | ArrayList<Map> tree = treeUtils.getTree(getOriginTag().getId(), getHostId()); | 
|---|
|  |  |  | // 深拷贝 | 
|---|
|  |  |  | List<Map> result = ListUtils.deepCopy(tree); | 
|---|
|  |  |  | if (!Cools.isEmpty(condition)) { | 
|---|
|  |  |  | 
|---|
|  |  |  | @ManagerAuth(memo = "商品档案数据导入") | 
|---|
|  |  |  | @Transactional | 
|---|
|  |  |  | public R matExcelImport(MultipartFile file) throws IOException { | 
|---|
|  |  |  | MatExcelListener listener = new MatExcelListener(getUserId()); | 
|---|
|  |  |  | MatExcelListener listener = new MatExcelListener(getUserId(), getHostId()); | 
|---|
|  |  |  | EasyExcel.read(file.getInputStream(), MatExcel.class, listener).sheet().doRead(); | 
|---|
|  |  |  | return R.ok("成功同步"+listener.getTotal()+"条商品数据"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /*************************************** xm-select ***********************************************/ | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // xm-select 搜索商品列表 | 
|---|
|  |  |  | @RequestMapping("/mat/all/get/kv") | 
|---|
|  |  |  | @ManagerAuth | 
|---|
|  |  |  | public R getMatDataKV(@RequestParam(required = false) String condition) { | 
|---|
|  |  |  | LambdaQueryWrapper<Mat> wrapper = new LambdaQueryWrapper<Mat>() | 
|---|
|  |  |  | .like(Mat::getMatnr, condition).or().like(Mat::getMaktx, condition) | 
|---|
|  |  |  | .orderByAsc(Mat::getCreateTime); | 
|---|
|  |  |  | List<Mat> mats = matService.page(new Page<>(1, 30), wrapper).getRecords(); | 
|---|
|  |  |  | List<KeyValueVo> valueVos = new ArrayList<>(); | 
|---|
|  |  |  | for (Mat mat : mats) { | 
|---|
|  |  |  | KeyValueVo vo = new KeyValueVo(); | 
|---|
|  |  |  | vo.setName(mat.getMatnr() + " - " + mat.getMaktx()); | 
|---|
|  |  |  | vo.setValue(mat.getId()); | 
|---|
|  |  |  | valueVos.add(vo); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return R.ok().add(valueVos); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|