diff --git a/sgzb-api/sgzb-api-system/src/main/java/com/bonus/sgzb/base/api/domain/MaType.java b/sgzb-api/sgzb-api-system/src/main/java/com/bonus/sgzb/base/api/domain/MaType.java index b28b7447..12922c3d 100644 --- a/sgzb-api/sgzb-api-system/src/main/java/com/bonus/sgzb/base/api/domain/MaType.java +++ b/sgzb-api/sgzb-api-system/src/main/java/com/bonus/sgzb/base/api/domain/MaType.java @@ -141,7 +141,7 @@ public class MaType extends BaseEntity { /** 图片路径 */ @ApiModelProperty(value = "图片路径") - private String photoUrl = "https://zlpt-1259760603.cos.ap-nanjing.myqcloud.com/zhcc/405D4B1F-0942-424e-B45A-C66FDDA74EEA.png"; + private String photoUrl; /** 文档名称 */ @ApiModelProperty(value = "文档名称") diff --git a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/controller/MaTypeController.java b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/controller/MaTypeController.java index 3db2f38a..883f9581 100644 --- a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/controller/MaTypeController.java +++ b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/base/controller/MaTypeController.java @@ -103,7 +103,8 @@ public class MaTypeController extends BaseController { if (level == 2) { // 查询二级 if (parentId == 0){ - return AjaxResult.success(maTypeMapper.selectMaTypeListByLevelNotFour(null,keyword)); + List maTypes = maTypeMapper.selectMaTypeListByLevelNotFour(null, keyword); + return AjaxResult.success(maTypes); }else { return AjaxResult.success(maTypeMapper.selectMaTypeListByLevelNotFour(parentId.toString(),keyword)); } diff --git a/sgzb-modules/sgzb-base/src/main/resources/mapper/base/MaMachineTypeMapper.xml b/sgzb-modules/sgzb-base/src/main/resources/mapper/base/MaMachineTypeMapper.xml index 233b8059..74513653 100644 --- a/sgzb-modules/sgzb-base/src/main/resources/mapper/base/MaMachineTypeMapper.xml +++ b/sgzb-modules/sgzb-base/src/main/resources/mapper/base/MaMachineTypeMapper.xml @@ -361,8 +361,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" select m.type_id, m.type_name, m.parent_id, m.status, m.num, m.unit_id, m.manage_type, m.lease_price, m.eff_time, m.rent_price, m.buy_price, m.pay_price, m.level, m.rated_load, m.test_load, m.holding_time, m.warn_num, m.del_flag, m.create_by, m.create_time, - m.remark, m.company_id + m.remark, m.company_id,mtf.file_url photoUrl from ma_type m + left join (select * from ma_type_file where file_type = '1') mtf on m.type_id = mtf.type_id m.level != 4 diff --git a/sgzb-modules/sgzb-system/src/main/java/com/bonus/sgzb/system/controller/SysProfileController.java b/sgzb-modules/sgzb-system/src/main/java/com/bonus/sgzb/system/controller/SysProfileController.java index c43662a2..35065ee4 100644 --- a/sgzb-modules/sgzb-system/src/main/java/com/bonus/sgzb/system/controller/SysProfileController.java +++ b/sgzb-modules/sgzb-system/src/main/java/com/bonus/sgzb/system/controller/SysProfileController.java @@ -1,17 +1,20 @@ package com.bonus.sgzb.system.controller; +import java.io.File; +import java.io.FileOutputStream; +import java.io.InputStream; import java.util.Arrays; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RestController; -import org.springframework.web.multipart.MultipartFile; +import cn.hutool.core.util.IdUtil; import com.bonus.sgzb.common.core.domain.R; +import com.bonus.sgzb.common.core.utils.DateTimeHelper; +import com.bonus.sgzb.system.api.domain.SysFile; +import com.bonus.sgzb.system.domain.FileInfo; +import com.bonus.sgzb.system.service.SysFileService; +import org.apache.commons.lang3.ObjectUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; import com.bonus.sgzb.common.core.utils.StringUtils; import com.bonus.sgzb.common.core.utils.file.FileTypeUtils; import com.bonus.sgzb.common.core.utils.file.MimeTypeUtils; @@ -22,10 +25,14 @@ import com.bonus.sgzb.common.log.enums.BusinessType; import com.bonus.sgzb.common.security.service.TokenService; import com.bonus.sgzb.common.security.utils.SecurityUtils; import com.bonus.sgzb.system.api.RemoteFileService; -import com.bonus.sgzb.system.api.domain.SysFile; import com.bonus.sgzb.system.api.domain.SysUser; import com.bonus.sgzb.system.api.model.LoginUser; import com.bonus.sgzb.system.service.ISysUserService; +import org.springframework.web.multipart.MultipartHttpServletRequest; +import org.springframework.web.multipart.commons.CommonsMultipartResolver; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; /** * 个人信息 业务处理 @@ -44,6 +51,9 @@ public class SysProfileController extends BaseController { @Autowired private RemoteFileService remoteFileService; + @Resource + private SysFileService sysFileService; + /** * 个人信息 */ @@ -113,27 +123,27 @@ public class SysProfileController extends BaseController { */ @Log(title = "用户头像", businessType = BusinessType.UPDATE) @PostMapping("/avatar") - public AjaxResult avatar(@RequestParam("avatarfile") MultipartFile file) { - if (!file.isEmpty()) { - LoginUser loginUser = SecurityUtils.getLoginUser(); - String extension = FileTypeUtils.getExtension(file); - if (!StringUtils.equalsAnyIgnoreCase(extension, MimeTypeUtils.IMAGE_EXTENSION)) { - return error("文件格式不正确,请上传" + Arrays.toString(MimeTypeUtils.IMAGE_EXTENSION) + "格式"); + public AjaxResult avatar(@RequestParam("avatarfile") MultipartFile file,String fileType) throws Exception { + FileInfo fileInfo = sysFileService.uploadHeadPic(file, fileType); + if (!file.isEmpty()) { + LoginUser loginUser = SecurityUtils.getLoginUser(); + String extension = FileTypeUtils.getExtension(file); + if (!StringUtils.equalsAnyIgnoreCase(extension, MimeTypeUtils.IMAGE_EXTENSION)) { + return error("文件格式不正确,请上传" + Arrays.toString(MimeTypeUtils.IMAGE_EXTENSION) + "格式"); + } + if (ObjectUtils.isEmpty(fileInfo)) { + return error("文件服务异常,请联系管理员"); + } + String url = fileInfo.getFileUrl(); + if (userService.updateUserAvatar(loginUser.getUsername(), url)) { + AjaxResult ajax = AjaxResult.success(); + ajax.put("imgUrl", url); + // 更新缓存用户头像 + loginUser.getSysUser().setAvatar(url); + tokenService.setLoginUser(loginUser); + return ajax; + } } - R fileResult = remoteFileService.upload(file); - if (StringUtils.isNull(fileResult) || StringUtils.isNull(fileResult.getData())) { - return error("文件服务异常,请联系管理员"); - } - String url = fileResult.getData().getUrl(); - if (userService.updateUserAvatar(loginUser.getUsername(), url)) { - AjaxResult ajax = AjaxResult.success(); - ajax.put("imgUrl", url); - // 更新缓存用户头像 - loginUser.getSysUser().setAvatar(url); - tokenService.setLoginUser(loginUser); - return ajax; - } - } return error("上传图片异常,请联系管理员"); } } diff --git a/sgzb-modules/sgzb-system/src/main/java/com/bonus/sgzb/system/service/SysFileService.java b/sgzb-modules/sgzb-system/src/main/java/com/bonus/sgzb/system/service/SysFileService.java index 0f70509d..098cb733 100644 --- a/sgzb-modules/sgzb-system/src/main/java/com/bonus/sgzb/system/service/SysFileService.java +++ b/sgzb-modules/sgzb-system/src/main/java/com/bonus/sgzb/system/service/SysFileService.java @@ -2,6 +2,7 @@ package com.bonus.sgzb.system.service; import com.bonus.sgzb.system.domain.FileInfo; +import org.springframework.web.multipart.MultipartFile; import javax.servlet.http.HttpServletRequest; @@ -20,4 +21,6 @@ public interface SysFileService */ FileInfo uploadFile(HttpServletRequest request) throws Exception; + FileInfo uploadHeadPic(MultipartFile file,String fileType) throws Exception; + } diff --git a/sgzb-modules/sgzb-system/src/main/java/com/bonus/sgzb/system/service/impl/SysFileServiceImpl.java b/sgzb-modules/sgzb-system/src/main/java/com/bonus/sgzb/system/service/impl/SysFileServiceImpl.java index ff67d335..d280ddc5 100644 --- a/sgzb-modules/sgzb-system/src/main/java/com/bonus/sgzb/system/service/impl/SysFileServiceImpl.java +++ b/sgzb-modules/sgzb-system/src/main/java/com/bonus/sgzb/system/service/impl/SysFileServiceImpl.java @@ -27,7 +27,7 @@ import java.util.*; /** * 本地文件存储 - * + * * @author zys */ @Primary @@ -39,7 +39,7 @@ public class SysFileServiceImpl implements SysFileService { /** * 本地文件上传接口 - * + * * @return 访问地址 * @throws Exception */ @@ -55,11 +55,11 @@ public class SysFileServiceImpl implements SysFileService { MultipartFile item = items.get(0); try { String url = saveFile(request, item, photoType); - if(url != null){ + if (url != null) { int words = getFileText(item); String fileName = item.getOriginalFilename(); String type = fileName.substring(fileName.lastIndexOf(".") + 1); - long size = item.getSize()/1024/1024; + long size = item.getSize() / 1024 / 1024; file.setFileName(fileName); file.setFileUrl(url); file.setCreator(userId.toString()); @@ -76,6 +76,40 @@ public class SysFileServiceImpl implements SysFileService { return file; } + /** + * 头像上传 + * + * @return 访问地址 + * @throws Exception + */ + @Override + public FileInfo uploadHeadPic(MultipartFile item,String fileType) { + FileInfo file = new FileInfo(); + Long userId = SecurityUtils.getUserId(); + try { + String url = saveFilePic(item, fileType); + if (url != null) { + int words = getFileText(item); + String fileName = item.getOriginalFilename(); + String type = fileName.substring(fileName.lastIndexOf(".") + 1); + long size = item.getSize() / 1024 / 1024; + file.setFileName(fileName); + file.setFileUrl(url); + file.setCreator(userId.toString()); + file.setType(type); + file.setSize(size + "M"); + file.setWords(words); + file.setCreateBy(SecurityUtils.getUserId().toString()); + file.setCreateTime(new Date()); + dao.insertFileInfo(file); + } + } catch (Exception e) { + e.printStackTrace(); + } + return file; + } + + public HashMap getFile(StandardMultipartHttpServletRequest request) { MultipartFile multipartFile; HashMap map = new HashMap(); @@ -86,7 +120,7 @@ public class SysFileServiceImpl implements SysFileService { multipartFile = request.getFile(itr.next()); tmps.add(multipartFile); } - map.put("filePath",tmps); + map.put("filePath", tmps); } catch (Exception e) { e.printStackTrace(); } @@ -97,22 +131,60 @@ public class SysFileServiceImpl implements SysFileService { String url = ""; String tmpName = multipartFile.getOriginalFilename();// 完整路径 IE tmpName = tmpName.substring(tmpName.lastIndexOf("\\") + 1); - tmpName = IdUtil.fastSimpleUUID() + System.currentTimeMillis() +tmpName.substring(tmpName.lastIndexOf("."),tmpName.length()); - String imageFiles="/data/sgzb/" + fileType + "/"; + tmpName = IdUtil.fastSimpleUUID() + System.currentTimeMillis() + tmpName.substring(tmpName.lastIndexOf("."), tmpName.length()); + String imageFiles = "/data/sgzb/" + fileType + "/"; String os = System.getProperty("os.name"); - if(os.toLowerCase().startsWith("win")){ - imageFiles="D://files/" + fileType + "/"; + if (os.toLowerCase().startsWith("win")) { + imageFiles = "D://files/" + fileType + "/"; } String year = DateTimeHelper.getNowYear(); String month = DateTimeHelper.getNowMonths(); String day = DateTimeHelper.getNowDay(); - String specfile = imageFiles + year +"/" + month +"/"+ day; + String specfile = imageFiles + year + "/" + month + "/" + day; File file = new File(specfile + "/" + tmpName); if (!file.getParentFile().exists()) { file.getParentFile().mkdirs(); } - url = "/" + fileType + "/" + year +"/" + month +"/"+ day + "/" + tmpName; + url = "/" + fileType + "/" + year + "/" + month + "/" + day + "/" + tmpName; + if (!multipartFile.isEmpty()) { + try { + FileOutputStream fos = new FileOutputStream(file); + InputStream in = multipartFile.getInputStream(); + byte[] bytes = new byte[1024]; + int len = 0; + while ((len = in.read(bytes)) != -1) { + fos.write(bytes, 0, len); + } + fos.close(); + in.close(); + } catch (Exception e) { + e.printStackTrace(); + } + } + return url; + } + + public String saveFilePic(MultipartFile multipartFile, String fileType) throws Exception { + String url = ""; + String tmpName = multipartFile.getOriginalFilename();// 完整路径 IE + tmpName = tmpName.substring(tmpName.lastIndexOf("\\") + 1); + tmpName = IdUtil.fastSimpleUUID() + System.currentTimeMillis() + tmpName.substring(tmpName.lastIndexOf("."), tmpName.length()); + String imageFiles = "/data/sgzb/" + fileType + "/"; + String os = System.getProperty("os.name"); + if (os.toLowerCase().startsWith("win")) { + imageFiles = "D://files/" + fileType + "/"; + } + String year = DateTimeHelper.getNowYear(); + String month = DateTimeHelper.getNowMonths(); + String day = DateTimeHelper.getNowDay(); + String specfile = imageFiles + year + "/" + month + "/" + day; + File file = new File(specfile + "/" + tmpName); + + if (!file.getParentFile().exists()) { + file.getParentFile().mkdirs(); + } + url = "/" + fileType + "/" + year + "/" + month + "/" + day + "/" + tmpName; if (!multipartFile.isEmpty()) { try { FileOutputStream fos = new FileOutputStream(file); diff --git a/sgzb-ui/src/views/claimAndRefund/receive/receiveApplyAdd.vue b/sgzb-ui/src/views/claimAndRefund/receive/receiveApplyAdd.vue index dfb2fae5..278ee3b5 100644 --- a/sgzb-ui/src/views/claimAndRefund/receive/receiveApplyAdd.vue +++ b/sgzb-ui/src/views/claimAndRefund/receive/receiveApplyAdd.vue @@ -287,16 +287,16 @@ export default { required:true,message:'请选择工程',trigger:'change',type:'number' } ], - leasePerson: [ - { - required: true, message: '请输入领料人', trigger: 'blur', - } - ], - phone: [ - {required: true, message: '请输入领料人手机号', trigger: 'change'}, - { validator: validatePhone, trigger: "blur" }, - { min: 11, message: "手机号不足11位", trigger: "blur" }, - ], + // leasePerson: [ + // { + // required: true, message: '请输入领料人', trigger: 'blur', + // } + // ], + // phone: [ + // {required: true, message: '请输入领料人手机号', trigger: 'change'}, + // { validator: validatePhone, trigger: "blur" }, + // { min: 11, message: "手机号不足11位", trigger: "blur" }, + // ], }, unitList:[], //单位 集合 proList:[], // 工程 集合 diff --git a/sgzb-ui/src/views/claimAndRefund/receive/receiveExamine.vue b/sgzb-ui/src/views/claimAndRefund/receive/receiveExamine.vue index 894388e8..7802c9c0 100644 --- a/sgzb-ui/src/views/claimAndRefund/receive/receiveExamine.vue +++ b/sgzb-ui/src/views/claimAndRefund/receive/receiveExamine.vue @@ -267,7 +267,7 @@ export default { //审核 同意 async subAuditLeaseByCompany(){ const params = JSON.parse(JSON.stringify(this.queryParams)) - params.taskStatus ++ + params.taskStatus = params.taskStatus+1 params.leaseApplyInfoList.forEach(v => { this.$set(v,'companyAuditRemark',params.companyAuditRemarks) this.$set(v,'companyAuditBy',this.user.id) diff --git a/sgzb-ui/src/views/claimAndRefund/receive/receiveManage.vue b/sgzb-ui/src/views/claimAndRefund/receive/receiveManage.vue index 9f5ddfe4..fa6fd9f5 100644 --- a/sgzb-ui/src/views/claimAndRefund/receive/receiveManage.vue +++ b/sgzb-ui/src/views/claimAndRefund/receive/receiveManage.vue @@ -210,7 +210,7 @@ import { getLeaseAuditListAll, getUnitData, getProData, getTaskDetail } from '@/ import { getInfo } from '@/api/login' import vueEasyPrint from 'vue-easy-print'; export default { - name: "ReceiveManage", + // name: "ReceiveManage", data() { return { // 遮罩层 diff --git a/sgzb-ui/src/views/claimAndRefund/return/returnExamine.vue b/sgzb-ui/src/views/claimAndRefund/return/returnExamine.vue index ed00b598..77ceb972 100644 --- a/sgzb-ui/src/views/claimAndRefund/return/returnExamine.vue +++ b/sgzb-ui/src/views/claimAndRefund/return/returnExamine.vue @@ -266,7 +266,7 @@ size="mini" type="primary" icon="el-icon-edit" - :disabled="scope.row.taskStatus == '38'" + v-if="scope.row.taskStatus == '37'" @click="handleUpdate(scope.row, 'update')" >审核 diff --git a/sgzb-ui/src/views/repairTest/repair/dialogOneForm.vue b/sgzb-ui/src/views/repairTest/repair/dialogOneForm.vue index 80999fc9..c4876198 100644 --- a/sgzb-ui/src/views/repairTest/repair/dialogOneForm.vue +++ b/sgzb-ui/src/views/repairTest/repair/dialogOneForm.vue @@ -140,7 +140,7 @@ ref="dynamicValidateFormTwo" :model="dynamicValidateFormTwo" class="demo-dynamic" - label-width="90px" + label-width="100px" >