k94314517
2025-07-15 67c98cdd79a1e473fe95ddc1c695ed162c176510
Merge remote-tracking branch 'origin/master'
已修改6个文件
117 ■■■■ 文件已修改
admin/src/views/business/categoryCar.vue 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/admin/src/main/java/com/doumee/api/business/CategoryController.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/services/src/main/java/com/doumee/api/common/PublicCloudController.java 70 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/services/src/main/java/com/doumee/dao/business/model/Category.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/services/src/main/java/com/doumee/service/business/CategoryService.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/services/src/main/java/com/doumee/service/business/impl/CategoryServiceImpl.java 24 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
admin/src/views/business/categoryCar.vue
@@ -31,6 +31,16 @@
            <span v-else >否</span>
          </template>
        </el-table-column>
        <el-table-column  prop="detail" label="可选规格" min-width="100px">
          <template slot-scope="{row}">
              <div v-if="row.detailList && row.detailList.length">
                <div v-for="item in row.detailList">
                  {{item || ''}}
                  <span v-if="item.index < row.detailList.length" style="margin: 10px">|</span>
                </div>
              </div>
          </template>
        </el-table-column>
        <el-table-column label="状态">
          <template slot-scope="{row}">
            <el-switch :disabled="row.isFixed ==1" @change="changeStatus($event, row)" v-model="row.status" active-color="#13ce66"
server/admin/src/main/java/com/doumee/api/business/CategoryController.java
@@ -40,8 +40,6 @@
    @PostMapping("/create")
    @RequiresPermissions("business:category:create")
    public ApiResponse create(@RequestBody Category category) {
        LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
        category.setLoginUserInfo(user);
        return ApiResponse.success(categoryService.create(category));
    }
@@ -54,9 +52,9 @@
    }
    @ApiOperation("修改状态")
    @PostMapping("/updateStatus")
    @RequiresPermissions("system:category:update")
    @RequiresPermissions("business:category:update")
    public ApiResponse updateStatus( @RequestBody Category param) {
        categoryService.updateById(param);
        categoryService.updateStatus(param);
        return ApiResponse.success(null);
    }
@@ -77,8 +75,6 @@
    @PostMapping("/updateById")
    @RequiresPermissions("business:category:update")
    public ApiResponse updateById(@RequestBody Category category) {
        LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
        category.setLoginUserInfo(user);
        categoryService.updateById(category);
        return ApiResponse.success(null);
    }
server/services/src/main/java/com/doumee/api/common/PublicCloudController.java
@@ -54,18 +54,74 @@
    @Autowired
    private SystemDictDataBiz systemDictDataBiz;
    @ApiOperation(value = "上传", notes = "上传", httpMethod = "POST", position = 6)
    @ApiOperation(value = "上传OBS", notes = "上传OBS", httpMethod = "POST", position = 6)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "folder", value = "文件夹", required = true, paramType = "query", dataType = "String", dataTypeClass = String.class),
            @ApiImplicitParam(name = "file", value = "文件夹", required = true, paramType = "query", dataType = "String", dataTypeClass = String.class),
    })
    @PostMapping(value = "/uploadLocal", headers = "content-type=multipart/form-data")
    public void uploadLocal(HttpServletRequest request, HttpServletResponse response) throws Exception {
    @PostMapping(value = "/upload", headers = "content-type=multipart/form-data")
    @ResponseBody
    public void upload(HttpServletRequest request, HttpServletResponse response, String folder) throws Exception {
        Date d1 = new Date();
        log.error("总得上传文件成功=============开始========="+DateUtil.getPlusTime2(d1));
        if(Objects.isNull(folder)){
            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"目标文件夹错误");
        }
        String prefixPath = systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.RESOURCE_PATH).getCode();
        InputStream is = null;
        response.setCharacterEncoding("UTF-8");
        response.setContentType("text/html;charset=UTF-8");
        Map<String, Object> context = new HashMap<>();
        try {
            CommonsMultipartResolver multipartResovler = new CommonsMultipartResolver();
            if (multipartResovler.isMultipart(request)) {
        MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
        uploadFileLocal(multipartRequest, response,
                systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.IMG_DIR).getCode() ,
                systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.FILE_DIR).getCode());
                Iterator<String> it = multipartRequest.getFileNames();
                while (it.hasNext()) {
                    MultipartFile file = multipartRequest.getFile(it.next());
                    System.out.println(file.getSize());
                    String originname = file.getOriginalFilename();
                    is = file.getInputStream();
                    String endType = ".jpg";
                    if(originname.indexOf(".")>0){
                        endType=originname.substring(originname.lastIndexOf("."),originname.length());
                    }
                    String date = DateUtil.getNowShortDate();
                    String fName =  date+"/"+ UUID.randomUUID()+endType;
                    String fileName = folder+"/"+fName;
                    boolean r =false;
                    ObsUtil obsUtil = new ObsUtil( systemDictDataBiz.queryByCode(Constants.HWY_OBS,Constants.HWY_OBS_ACCESSID).getCode(),
                            systemDictDataBiz.queryByCode(Constants.HWY_OBS,Constants.HWY_OBS_ACCESSKEY).getCode(),
                            systemDictDataBiz.queryByCode(Constants.HWY_OBS,Constants.HWY_OBS_ENDPOINT).getCode());
                    r = obsUtil.uploadFile( systemDictDataBiz.queryByCode(Constants.HWY_OBS,Constants.HWY_OBS_BUCKET).getCode(),is,fileName);//上传
                    if(r){
                        context.put("success", true);
                        context.put("code", 200);
                        context.put("errno",0);
                        JSONObject fileJSON = new JSONObject();
//                        fileJSON.put("prefixPath", prefixPath);
//                        fileJSON.put("folder", folder);
                        fileJSON.put("url", prefixPath+fileName);
                        fileJSON.put("imgaddr", fName);
                        fileJSON.put("imgname", fileName);
                        fileJSON.put("originname", originname);
                        context.put("data",fileJSON);
                        context.put("message","请求成功");
                        writerJson(response, context);
                        Date d2= new Date();
                        log.error("总的上传文件成功=============结束========="+DateUtil.getPlusTime2(d2) +"耗时秒:"+( (d2.getTime()-d1.getTime()) /1000));
                        return;
                    }
                }
            }
        } catch (Exception e) {
            log.error("【上传FTP失败】======================"+e.getMessage());
        }
        context.put("code", 0);
        context.put("message", "上传失败");
        context.put("errno",0);
        writerJson(response, context);
        return;
    }
server/services/src/main/java/com/doumee/dao/business/model/Category.java
@@ -89,7 +89,4 @@
    @ApiModelProperty(value = "图标全路径")
    @TableField(exist = false)
    private String iconFull;
    @ApiModelProperty(hidden = true)
    private LoginUserInfo loginUserInfo;
}
server/services/src/main/java/com/doumee/service/business/CategoryService.java
@@ -54,7 +54,7 @@
     * @param categorys 实体集
     */
    void updateByIdInBatch(List<Category> categorys);
    void updateStatus(Category category);
    /**
     * 主键查询
     *
server/services/src/main/java/com/doumee/service/business/impl/CategoryServiceImpl.java
@@ -21,6 +21,7 @@
import com.github.yulichang.base.MPJBaseMapper;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.checkerframework.checker.units.qual.C;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -56,10 +57,12 @@
        ){
            throw new BusinessException(ResponseStatus.BAD_REQUEST);
        }
        LoginUserInfo loginUserInfo = category.getLoginUserInfo();
        category.setCreateTime(new Date());
        LoginUserInfo loginUserInfo = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
        category.setDeleted(Constants.ZERO);
        category.setCreateTime(new Date());
        category.setCreateUser(loginUserInfo.getId());
        category.setUpdateTime(new Date());
        category.setUpdateUser(loginUserInfo.getId());
        if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(category.getDetailList())){
            category.setDetail(category.getDetailList().toJSONString());
        }
@@ -103,7 +106,22 @@
        ){
            throw new BusinessException(ResponseStatus.BAD_REQUEST);
        }
        LoginUserInfo loginUserInfo = category.getLoginUserInfo();
        LoginUserInfo loginUserInfo = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
        category.setUpdateTime(new Date());
        category.setIsFixed(null);
        category.setUpdateUser(loginUserInfo.getId());
        if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(category.getDetailList())){
            category.setDetail(category.getDetailList().toJSONString());
        }
        categoryMapper.updateById(category);
    }
    @Override
    public void updateStatus(Category category) {
        if(Objects.isNull(category)
                || Objects.isNull(category.getId())){
            throw new BusinessException(ResponseStatus.BAD_REQUEST);
        }
        LoginUserInfo loginUserInfo = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
        category.setUpdateTime(new Date());
        category.setIsFixed(null);
        category.setUpdateUser(loginUserInfo.getId());