|
@@ -30,10 +30,9 @@ import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import java.time.LocalDateTime;
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
+import java.util.*;
|
|
|
+import java.util.regex.Matcher;
|
|
|
+import java.util.regex.Pattern;
|
|
|
|
|
|
@RestController
|
|
|
@RequestMapping("/admin/common")
|
|
@@ -56,6 +55,7 @@ public class CommonController {
|
|
|
private GenerateSerial generateSerial;
|
|
|
|
|
|
|
|
|
+
|
|
|
@PostMapping("/{formCode}/saveJson")
|
|
|
public Result saveJson(@RequestBody Map<String, Object> obj, @PathVariable("formCode") String formCode) {
|
|
|
String json = (String) obj.get("json");
|
|
@@ -223,7 +223,20 @@ public class CommonController {
|
|
|
return result;
|
|
|
}
|
|
|
}
|
|
|
+ //-----------------------
|
|
|
+ //更新文件类型
|
|
|
+ if(obj.containsKey("contractFile") && !Objects.isNull(obj.get("contractFile"))){
|
|
|
+ String contractFile = obj.get("contractFile").toString();
|
|
|
+ String businessType = obj.get("businessType").toString();
|
|
|
+ Pattern pattern = Pattern.compile("/([^/]+)/[^/]+\\.(\\w+)");
|
|
|
+ Matcher matcher = pattern.matcher(contractFile);
|
|
|
+ if (matcher.find()) {
|
|
|
+ String extractedString = matcher.group(1);
|
|
|
+ jdbcService.update("更新","update sys_file set business_type = ? where id = ? ",businessType,extractedString);
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
+ //-----------------------
|
|
|
final Map<String,Object> dbObj = obj;
|
|
|
try{
|
|
|
jdbcService.transactionOption(()->{
|
|
@@ -619,8 +632,8 @@ public class CommonController {
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
- @RequestMapping("/{model}/apply/{id}/{status}")
|
|
|
- public Result apply(@PathVariable("id") Long id, @PathVariable("model") String model,@PathVariable("status") Long status) {
|
|
|
+ @RequestMapping("/{model}/apply/{id}/{field}/{status}")
|
|
|
+ public Result apply(@PathVariable("id") Long id, @PathVariable("model") String model,@PathVariable("status") Long status,@PathVariable("field") String field) {
|
|
|
String tableName = StringUtil.toSqlColumn(model);
|
|
|
Long enterpriseId = SessionContext.getSession().getEnterpriseId();
|
|
|
|
|
@@ -628,7 +641,7 @@ public class CommonController {
|
|
|
return Result.error("没有数据权限.");
|
|
|
}
|
|
|
|
|
|
- jdbcService.apply(id,tableName,status);
|
|
|
+ jdbcService.apply(id,tableName,status,field);
|
|
|
|
|
|
return Result.success();
|
|
|
}
|