Pu Zhibing
3 天以前 25cf266e99714ac5d428e66b40ce272325c91dd8
ManagementQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TVersionManagementController.java
@@ -4,23 +4,20 @@
import com.baomidou.mybatisplus.plugins.Page;
import com.stylefeng.guns.config.properties.GunsProperties;
import com.stylefeng.guns.core.base.controller.BaseController;
import com.stylefeng.guns.core.beetl.ShiroExtUtil;
import com.stylefeng.guns.core.common.constant.factory.PageFactory;
import com.stylefeng.guns.core.shiro.ShiroKit;
import com.stylefeng.guns.core.log.LogObjectHolder;
import com.stylefeng.guns.core.util.SinataUtil;
import com.stylefeng.guns.core.util.ToolUtil;
import com.stylefeng.guns.modular.system.model.TPubWithdrawal;
import com.stylefeng.guns.modular.system.util.OssUploadUtil;
import com.stylefeng.guns.modular.system.util.PushMinistryOfTransportUtil;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.ui.Model;
import org.springframework.beans.factory.annotation.Autowired;
import com.stylefeng.guns.core.log.LogObjectHolder;
import com.stylefeng.guns.modular.system.model.TVersionManagement;
import com.stylefeng.guns.modular.system.service.ITVersionManagementService;
import com.stylefeng.guns.modular.system.util.PushMinistryOfTransportUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import javax.servlet.http.HttpServletRequest;
import java.io.File;
@@ -106,10 +103,10 @@
            endTime = timeArray[1];
        }
        Page<Map<String, Object>> page = new PageFactory<Map<String, Object>>().defaultPage();
        if (ShiroKit.getUser().getRoleType() != 1){
        if (ShiroExtUtil.getUser().getRoleType() != 1) {
            page.setRecords(null);
        }else{
            page.setRecords(tVersionManagementService.getVersionList(page,beginTime,endTime,version));
        } else {
            page.setRecords(tVersionManagementService.getVersionList(page, beginTime, endTime, version));
        }
        return super.packForBT(page);
    }
@@ -124,26 +121,26 @@
     */
    @ResponseBody
    @RequestMapping("/saveApk")
    public Map<String, Object> saveApk(@RequestPart("myfile") MultipartFile myfile, HttpServletRequest request){
    public Map<String, Object> saveApk(@RequestPart("myfile") MultipartFile myfile, HttpServletRequest request) {
        Map<String, Object> m = new HashMap<>();
        /*try {
            String pictureName = UUID.randomUUID().toString() + "." + ToolUtil.getFileSuffix(file.getOriginalFilename());
        try {
            String pictureName = UUID.randomUUID().toString() + "." + ToolUtil.getFileSuffix(myfile.getOriginalFilename());
            try {
                String fileSavePath = gunsProperties.getFileUploadPath()+"apk\\";
                file.transferTo(new File(fileSavePath + pictureName));
                String fileSavePath = gunsProperties.getFileUploadPath() + "apk\\";
                myfile.transferTo(new File(fileSavePath + pictureName));
            } catch (Exception e) {
                e.printStackTrace();
            }
            m.put("imgUrl", gunsProperties.getPictureServerAddress()+"apk/"+pictureName);
            m.put("imgUrl", gunsProperties.getPictureServerAddress() + "apk/" + pictureName);
        } catch (Exception e) {
            e.printStackTrace();
        }*/
        try {
            String pictureName = OssUploadUtil.ossUpload(request, myfile);
            m.put("imgUrl", pictureName);
        }catch (Exception e){
            e.printStackTrace();
        }
//        try {
//            String pictureName = OssUploadUtil.ossUpload(request, myfile);
//            m.put("imgUrl", pictureName);
//        }catch (Exception e){
//            e.printStackTrace();
//        }
        return m;
    }