1、文件修改时设置数据类型不可修改,同时更新文件编码

master
xiong_cl 7 months ago
parent 4873ae480b
commit 4736dfa7da
  1. 19
      shandan-system/src/main/java/com/keyware/shandan/system/controller/SysFileController.java
  2. 6
      shandan-system/src/main/resources/view/sys/file/fileEditLayer.html

@ -153,6 +153,20 @@ public class SysFileController extends BaseController<SysFileService, SysFile, S
return mav; return mav;
} }
@PostMapping("/update")
public Result<SysFile> save(SysFile sysFile) throws Exception {
//自动编号,每天从一开始
String curDate = new SimpleDateFormat("yyyyMMdd").format(new Date());
if("".equals(LAST_DATE) || curDate.compareTo(LAST_DATE) > 0){
LAST_DATE = curDate;
counter = new Counter();
}
SysFile byId = sysFileService.getById(sysFile.getId());
sysFile.setFileNumber(byId.getFileNumber());
sysFile.setFileCode(createFileCode(sysFile));
return sysFileService.updateOrSave(sysFile);
}
/** /**
* 文件上传 * 文件上传
* *
@ -328,8 +342,8 @@ public class SysFileController extends BaseController<SysFileService, SysFile, S
sb.append("0").append("+"); sb.append("0").append("+");
} }
//资料类型,文件后缀大写 //资料类型,文件后缀大写
if(!StringUtils.isEmpty(file.getFileFullName())){ if(!StringUtils.isEmpty(file.getFileName())){
String fullName = file.getFileFullName(); String fullName = file.getFileName();
sb.append(fullName.substring(fullName.lastIndexOf(".")+1).toUpperCase()).append("+"); sb.append(fullName.substring(fullName.lastIndexOf(".")+1).toUpperCase()).append("+");
}else{ }else{
sb.append("0").append("+"); sb.append("0").append("+");
@ -339,6 +353,7 @@ public class SysFileController extends BaseController<SysFileService, SysFile, S
for(int i=0;i<objects.size();i++){ for(int i=0;i<objects.size();i++){
if(file.getFileFullName().equals(objects.getJSONObject(i).getString("name"))){ if(file.getFileFullName().equals(objects.getJSONObject(i).getString("name"))){
file.setFileNumber(objects.getJSONObject(i).getString("number")); file.setFileNumber(objects.getJSONObject(i).getString("number"));
break;
} }
} }
} }

@ -46,7 +46,7 @@
<input type="hidden" name="isFirst"> <input type="hidden" name="isFirst">
<div class="layui-form-item" <div class="layui-form-item"
th:each="field,iterStat : ${allUploadFormConfig.get(file.dataType)}" th:each="field,iterStat : ${allUploadFormConfig.get(file.dataType)}"
th:if="${field.isShow && field.fieldName != 'dataType'}" th:if="${field.isShow}"
th:style="${field.fieldType == 'textarea' ? 'width: calc(100% - 30px);' : ''}" th:style="${field.fieldType == 'textarea' ? 'width: calc(100% - 30px);' : ''}"
th:with="username=*{userName}"> th:with="username=*{userName}">
<label th:if="${field.isRequired}" class="layui-form-label"> <label th:if="${field.isRequired}" class="layui-form-label">
@ -86,7 +86,7 @@
<!-- 数据字典类型 --> <!-- 数据字典类型 -->
<div dict-component="select" <div dict-component="select"
th:if="${field.fieldType == 'dict'}" th:if="${field.fieldType == 'dict'}"
th:disabled="${field.isDisabled}" th:disabled="${field.fieldName == 'dataType' ? true : field.isDisabled}"
th:dict-type="${field.dictType}" th:dict-type="${field.dictType}"
th:dict-name="${field.fieldName}" th:dict-name="${field.fieldName}"
th:id="${'dict-'+field.fieldName}"></div> th:id="${'dict-'+field.fieldName}"></div>
@ -167,7 +167,7 @@
formVal.labels = layui.datalabel.getData(formVal.id, 'file'); formVal.labels = layui.datalabel.getData(formVal.id, 'file');
await $.ajax({ await $.ajax({
url: `${ctx}/sys/file/save`, url: `${ctx}/sys/file/update`,
type: 'post', type: 'post',
data: formVal, data: formVal,
async: false, async: false,