diff --git a/eladmin-web/src/api/bus/busCarousel/busCarousel.js b/eladmin-web/src/api/bus/busCarousel/busCarousel.js new file mode 100644 index 0000000..2103638 --- /dev/null +++ b/eladmin-web/src/api/bus/busCarousel/busCarousel.js @@ -0,0 +1,19 @@ +import request from '@/utils/request' + +export function add(data) { + return request({ + url: 'api/busCarousel', + method: 'post', + data + }) +} + +export function del(ids) { + return request({ + url: 'api/busCarousel/', + method: 'delete', + data: ids + }) +} + +export default { add, del } diff --git a/eladmin-web/src/views/bus/busCarousel/index.vue b/eladmin-web/src/views/bus/busCarousel/index.vue new file mode 100644 index 0000000..a738522 --- /dev/null +++ b/eladmin-web/src/views/bus/busCarousel/index.vue @@ -0,0 +1,155 @@ + + + + + diff --git a/eladmin-web/src/views/bus/busDevice/index.vue b/eladmin-web/src/views/bus/busDevice/index.vue index 710dca6..ff1846c 100644 --- a/eladmin-web/src/views/bus/busDevice/index.vue +++ b/eladmin-web/src/views/bus/busDevice/index.vue @@ -8,10 +8,6 @@ - - - - @@ -93,7 +89,7 @@ - + @@ -106,7 +102,7 @@ import rrOperation from '@crud/RR.operation' import crudOperation from '@crud/CRUD.operation' import udOperation from '@crud/UD.operation' import pagination from '@crud/Pagination' -import {mapGetters} from "vuex"; +import { mapGetters } from 'vuex' const defaultForm = { id: null, deviceSn: null, model: null, brand: null, firmwareVersion: null, location: null, status: null, onlineTime: null, offlineTime: null, totalPrintTime: null, remark: null, type: null, createBy: null, updateBy: null, createTime: null, updateTime: null } export default { diff --git a/eladmin/eladmin-logging/src/main/java/me/zhengjie/service/impl/SysLogServiceImpl.java b/eladmin/eladmin-logging/src/main/java/me/zhengjie/service/impl/SysLogServiceImpl.java index 308332a..71b87bf 100644 --- a/eladmin/eladmin-logging/src/main/java/me/zhengjie/service/impl/SysLogServiceImpl.java +++ b/eladmin/eladmin-logging/src/main/java/me/zhengjie/service/impl/SysLogServiceImpl.java @@ -17,6 +17,7 @@ package me.zhengjie.service.impl; import cn.hutool.core.lang.Dict; import com.alibaba.fastjson2.JSON; +import com.alibaba.fastjson2.JSONArray; import com.alibaba.fastjson2.JSONObject; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; @@ -123,6 +124,10 @@ public class SysLogServiceImpl extends ServiceImpl impleme if (args[i] instanceof HttpServletRequest) { continue; } + // 过滤掉 JSONArray + if (args[i] instanceof JSONArray) { + continue; + } // 将RequestBody注解修饰的参数作为请求参数 RequestBody requestBody = parameters[i].getAnnotation(RequestBody.class); if (requestBody != null) { diff --git a/eladmin/eladmin-system/pom.xml b/eladmin/eladmin-system/pom.xml index acca57b..fc2f089 100644 --- a/eladmin/eladmin-system/pom.xml +++ b/eladmin/eladmin-system/pom.xml @@ -37,25 +37,6 @@ jjwt-jackson ${jjwt.version} - - - - - - - - - - - - - - - - - - - diff --git a/eladmin/eladmin-system/src/main/java/me/zhengjie/modules/front/rest/BusCarouselController.java b/eladmin/eladmin-system/src/main/java/me/zhengjie/modules/front/rest/BusCarouselController.java new file mode 100644 index 0000000..3854f8b --- /dev/null +++ b/eladmin/eladmin-system/src/main/java/me/zhengjie/modules/front/rest/BusCarouselController.java @@ -0,0 +1,49 @@ +/* +* Copyright 2019-2025 Tz +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package me.zhengjie.modules.front.rest; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import me.zhengjie.annotation.Log; +import me.zhengjie.modules.system.domain.BusCarousel; +import me.zhengjie.modules.system.domain.dto.BusCarouselQueryCriteria; +import me.zhengjie.modules.system.service.BusCarouselService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.*; + +import java.util.List; +import java.util.stream.Collectors; + +@Slf4j +@RestController("CarouselController") +@RequestMapping("api/front/carousel") +@Api(tags = "微信:轮播图") +public class BusCarouselController { + + @Autowired BusCarouselService busCarouselService; + + @Log("轮播图") + @ApiOperation(value = "轮播图") + @GetMapping() + public ResponseEntity> queryBusCarousel(){ + List busCarousels = busCarouselService.queryAll(new BusCarouselQueryCriteria()); + List list = busCarousels.stream().map(BusCarousel::getPath).collect(Collectors.toList()); + return new ResponseEntity<>(list,HttpStatus.OK); + } +} \ No newline at end of file diff --git a/eladmin/eladmin-system/src/main/java/me/zhengjie/modules/front/service/impl/WeChatServiceImpl.java b/eladmin/eladmin-system/src/main/java/me/zhengjie/modules/front/service/impl/WeChatServiceImpl.java index bf8b093..eaaa2e2 100644 --- a/eladmin/eladmin-system/src/main/java/me/zhengjie/modules/front/service/impl/WeChatServiceImpl.java +++ b/eladmin/eladmin-system/src/main/java/me/zhengjie/modules/front/service/impl/WeChatServiceImpl.java @@ -65,9 +65,9 @@ public class WeChatServiceImpl implements WeChatService { @Override public LoginVo authorizeLogin(String code, HttpServletRequest request) { LoginVo loginVo = new LoginVo(); - WeChatMiniAuthorizeVo response = miniAuthCode(code); - // WeChatMiniAuthorizeVo response = new WeChatMiniAuthorizeVo(); - // response.setOpenId("123456"); + // WeChatMiniAuthorizeVo response = miniAuthCode(code); + WeChatMiniAuthorizeVo response = new WeChatMiniAuthorizeVo(); + response.setOpenId("123456"); String openId = response.getOpenId(); String type = "login"; BusUser busUser = BusUserMapper.getUserByOpenId(openId); diff --git a/eladmin/eladmin-system/src/main/java/me/zhengjie/modules/system/domain/BusCarousel.java b/eladmin/eladmin-system/src/main/java/me/zhengjie/modules/system/domain/BusCarousel.java new file mode 100644 index 0000000..e0557b7 --- /dev/null +++ b/eladmin/eladmin-system/src/main/java/me/zhengjie/modules/system/domain/BusCarousel.java @@ -0,0 +1,53 @@ +/* +* Copyright 2019-2025 Tz +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package me.zhengjie.modules.system.domain; + +import lombok.Data; +import cn.hutool.core.bean.BeanUtil; +import io.swagger.annotations.ApiModelProperty; +import cn.hutool.core.bean.copier.CopyOptions; +import javax.validation.constraints.NotBlank; +import java.io.Serializable; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; + +/** +* @description / +* @author tangz +* @date 2025-07-30 +**/ +@Data +@TableName("bus_carousel") +public class BusCarousel implements Serializable { + + @TableId(value = "id", type = IdType.AUTO) + @ApiModelProperty(value = "编号") + private Integer id; + + @ApiModelProperty(value = "名称") + private String name; + + @ApiModelProperty(value = "路径") + private String path; + + @ApiModelProperty(value = "排行") + private Integer sort; + + public void copy(BusCarousel source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/eladmin/eladmin-system/src/main/java/me/zhengjie/modules/system/domain/dto/BusCarouselQueryCriteria.java b/eladmin/eladmin-system/src/main/java/me/zhengjie/modules/system/domain/dto/BusCarouselQueryCriteria.java new file mode 100644 index 0000000..28d1450 --- /dev/null +++ b/eladmin/eladmin-system/src/main/java/me/zhengjie/modules/system/domain/dto/BusCarouselQueryCriteria.java @@ -0,0 +1,33 @@ +/* +* Copyright 2019-2025 Tz +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package me.zhengjie.modules.system.domain.dto; + +import lombok.Data; +import io.swagger.annotations.ApiModelProperty; + +/** +* @author tangz +* @date 2025-07-30 +**/ +@Data +public class BusCarouselQueryCriteria{ + + @ApiModelProperty(value = "页码", example = "1") + private Integer page = 1; + + @ApiModelProperty(value = "每页数据量", example = "10") + private Integer size = 10; +} \ No newline at end of file diff --git a/eladmin/eladmin-system/src/main/java/me/zhengjie/modules/system/mapper/BusCarouselMapper.java b/eladmin/eladmin-system/src/main/java/me/zhengjie/modules/system/mapper/BusCarouselMapper.java new file mode 100644 index 0000000..78246aa --- /dev/null +++ b/eladmin/eladmin-system/src/main/java/me/zhengjie/modules/system/mapper/BusCarouselMapper.java @@ -0,0 +1,38 @@ +/* +* Copyright 2019-2025 Tz +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package me.zhengjie.modules.system.mapper; + +import java.util.List; + +import me.zhengjie.modules.system.domain.BusCarousel; +import me.zhengjie.modules.system.domain.dto.BusCarouselQueryCriteria; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Mapper; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; + +/** +* @author tangz +* @date 2025-07-30 +**/ +@Mapper +public interface BusCarouselMapper extends BaseMapper { + + IPage findAll(@Param("criteria") BusCarouselQueryCriteria criteria, Page page); + + List findAll(@Param("criteria") BusCarouselQueryCriteria criteria); +} \ No newline at end of file diff --git a/eladmin/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/BusCarouselController.java b/eladmin/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/BusCarouselController.java new file mode 100644 index 0000000..42a077d --- /dev/null +++ b/eladmin/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/BusCarouselController.java @@ -0,0 +1,97 @@ +/* +* Copyright 2019-2025 Tz +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package me.zhengjie.modules.system.rest; + +import cn.hutool.core.util.ObjectUtil; +import me.zhengjie.annotation.Log; +import me.zhengjie.config.properties.FileProperties; +import me.zhengjie.exception.BadRequestException; +import me.zhengjie.modules.system.domain.BusCarousel; +import me.zhengjie.modules.system.domain.dto.BusCarouselQueryCriteria; +import me.zhengjie.modules.system.service.BusCarouselService; +import lombok.RequiredArgsConstructor; + +import java.io.File; +import java.util.ArrayList; +import java.util.Set; + +import me.zhengjie.utils.FileUtil; +import me.zhengjie.utils.StringUtils; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; +import io.swagger.annotations.*; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import me.zhengjie.utils.PageResult; +import org.springframework.web.multipart.MultipartFile; + +/** +* @author tangz +* @date 2025-07-30 +**/ +@RestController +@RequiredArgsConstructor +@Api(tags = "系统:轮播图") +@RequestMapping("/api/busCarousel") +public class BusCarouselController { + + private final BusCarouselService busCarouselService; + private final FileProperties fileProperties; + + @GetMapping + @ApiOperation("查询carousel") + @PreAuthorize("@el.check('busCarousel:list')") + public ResponseEntity> queryBusCarousel(BusCarouselQueryCriteria criteria){ + Page page = new Page<>(criteria.getPage(), criteria.getSize()); + return new ResponseEntity<>(busCarouselService.queryAll(criteria,page),HttpStatus.OK); + } + + @DeleteMapping + @Log("删除carousel") + @ApiOperation("删除用户") + @PreAuthorize("@el.check('busCarousel:del')") + public ResponseEntity deleteBusCarousel(@RequestBody Set ids){ + for (Long id : ids) { + busCarouselService.deleteAll(new ArrayList(){{ add(id); }}); + } + return new ResponseEntity<>(HttpStatus.OK); + } + + @Log("新增carousel") + @ApiOperation("上传轮播图") + @PostMapping("/pictures") + public ResponseEntity uploadPicture(@RequestParam String sort, @RequestParam MultipartFile file){ + // 判断文件是否为图片 + String suffix = FileUtil.getExtensionName(file.getOriginalFilename()); + if(!FileUtil.IMAGE.equals(FileUtil.getFileType(suffix))){ + throw new BadRequestException("只能上传图片"); + } + String type = FileUtil.getFileType(suffix); + String path = fileProperties.getPath().getAvatar(); + File uploadFile = FileUtil.upload(file, path + type + File.separator); + if(ObjectUtil.isNull(uploadFile)){ + throw new BadRequestException("上传失败"); + } + String[] split = path.split("/"); + String imgUrl = "/" + split[split.length - 1] + "/" + type + "/" + uploadFile.getName(); + BusCarousel resources = new BusCarousel(); + resources.setSort(StringUtils.isEmpty(sort) ? null : Integer.parseInt(sort)); + resources.setPath(imgUrl); + busCarouselService.create(resources); + return new ResponseEntity<>(HttpStatus.CREATED); + } +} \ No newline at end of file diff --git a/eladmin/eladmin-system/src/main/java/me/zhengjie/modules/system/service/BusCarouselService.java b/eladmin/eladmin-system/src/main/java/me/zhengjie/modules/system/service/BusCarouselService.java new file mode 100644 index 0000000..92dd4cf --- /dev/null +++ b/eladmin/eladmin-system/src/main/java/me/zhengjie/modules/system/service/BusCarouselService.java @@ -0,0 +1,74 @@ +/* +* Copyright 2019-2025 Tz +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package me.zhengjie.modules.system.service; + +import java.util.List; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.IService; +import me.zhengjie.modules.system.domain.BusCarousel; +import me.zhengjie.modules.system.domain.dto.BusCarouselQueryCriteria; +import me.zhengjie.utils.PageResult; + +/** +* @description 服务接口 +* @author tangz +* @date 2025-07-30 +**/ +public interface BusCarouselService extends IService { + + /** + * 查询数据分页 + * @param criteria 条件 + * @param page 分页参数 + * @return PageResult + */ + PageResult queryAll(BusCarouselQueryCriteria criteria, Page page); + + /** + * 查询所有数据不分页 + * @param criteria 条件参数 + * @return List + */ + List queryAll(BusCarouselQueryCriteria criteria); + + /** + * 创建 + * @param resources / + */ + void create(BusCarousel resources); + + /** + * 编辑 + * @param resources / + */ + void update(BusCarousel resources); + + /** + * 多选删除 + * @param ids / + */ + void deleteAll(List ids); + + /** + * 导出数据 + * @param all 待导出的数据 + * @param response / + * @throws IOException / + */ + void download(List all, HttpServletResponse response) throws IOException; +} \ No newline at end of file diff --git a/eladmin/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/BusCarouselServiceImpl.java b/eladmin/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/BusCarouselServiceImpl.java new file mode 100644 index 0000000..e5c213c --- /dev/null +++ b/eladmin/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/BusCarouselServiceImpl.java @@ -0,0 +1,90 @@ +/* +* Copyright 2019-2025 Tz +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package me.zhengjie.modules.system.service.impl; + +import me.zhengjie.modules.system.domain.BusCarousel; +import me.zhengjie.modules.system.domain.dto.BusCarouselQueryCriteria; +import me.zhengjie.modules.system.mapper.BusCarouselMapper; +import me.zhengjie.modules.system.service.BusCarouselService; +import me.zhengjie.utils.FileUtil; +import lombok.RequiredArgsConstructor; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import me.zhengjie.utils.PageUtil; +import java.util.List; +import java.util.Map; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import me.zhengjie.utils.PageResult; + +/** +* @description 服务实现 +* @author tangz +* @date 2025-07-30 +**/ +@Service +@RequiredArgsConstructor +public class BusCarouselServiceImpl extends ServiceImpl implements BusCarouselService { + + private final BusCarouselMapper busCarouselMapper; + + @Override + public PageResult queryAll(BusCarouselQueryCriteria criteria, Page page){ + return PageUtil.toPage(busCarouselMapper.findAll(criteria, page)); + } + + @Override + public List queryAll(BusCarouselQueryCriteria criteria){ + return busCarouselMapper.findAll(criteria); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void create(BusCarousel resources) { + busCarouselMapper.insert(resources); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(BusCarousel resources) { + BusCarousel busCarousel = getById(resources.getId()); + busCarousel.copy(resources); + busCarouselMapper.updateById(busCarousel); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void deleteAll(List ids) { + busCarouselMapper.deleteBatchIds(ids); + } + + @Override + public void download(List all, HttpServletResponse response) throws IOException { + List> list = new ArrayList<>(); + for (BusCarousel busCarousel : all) { + Map map = new LinkedHashMap<>(); + map.put("名称", busCarousel.getName()); + map.put("路径", busCarousel.getPath()); + map.put("排行", busCarousel.getSort()); + list.add(map); + } + FileUtil.downloadExcel(list, response); + } +} \ No newline at end of file diff --git a/eladmin/eladmin-system/src/main/resources/mapper/system/BusCarouselMapper.xml b/eladmin/eladmin-system/src/main/resources/mapper/system/BusCarouselMapper.xml new file mode 100644 index 0000000..fa7deeb --- /dev/null +++ b/eladmin/eladmin-system/src/main/resources/mapper/system/BusCarouselMapper.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + id, name, path, sort + + + + \ No newline at end of file