|
@@ -28,14 +28,13 @@ import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
/**
|
|
/**
|
|
* 用户档案Controller
|
|
* 用户档案Controller
|
|
- *
|
|
|
|
|
|
+ *
|
|
* @author zhengjie
|
|
* @author zhengjie
|
|
* @date 2023-08-25
|
|
* @date 2023-08-25
|
|
*/
|
|
*/
|
|
@RestController
|
|
@RestController
|
|
@RequestMapping("/system/profile")
|
|
@RequestMapping("/system/profile")
|
|
-public class TUserProfileController extends BaseController
|
|
|
|
-{
|
|
|
|
|
|
+public class TUserProfileController extends BaseController {
|
|
@Autowired
|
|
@Autowired
|
|
private ITUserProfileService tUserProfileService;
|
|
private ITUserProfileService tUserProfileService;
|
|
@Autowired
|
|
@Autowired
|
|
@@ -43,16 +42,15 @@ public class TUserProfileController extends BaseController
|
|
@Autowired
|
|
@Autowired
|
|
private ISysDeptfileService sysDeptfileService;
|
|
private ISysDeptfileService sysDeptfileService;
|
|
|
|
|
|
- Map<Object,Integer> map = new HashMap<>();
|
|
|
|
- Map<String,String> mapUrl = new HashMap<>();
|
|
|
|
|
|
+ Map<Object, Integer> map = new HashMap<>();
|
|
|
|
+ Map<String, String> mapUrl = new HashMap<>();
|
|
|
|
|
|
/**
|
|
/**
|
|
* 查询用户档案列表
|
|
* 查询用户档案列表
|
|
*/
|
|
*/
|
|
@PreAuthorize("@ss.hasPermi('system:profile:list')")
|
|
@PreAuthorize("@ss.hasPermi('system:profile:list')")
|
|
@GetMapping("/list")
|
|
@GetMapping("/list")
|
|
- public TableDataInfo list(TUserProfile tUserProfile)
|
|
|
|
- {
|
|
|
|
|
|
+ public TableDataInfo list(TUserProfile tUserProfile) {
|
|
startPage();
|
|
startPage();
|
|
List<TUserProfile> list = tUserProfileService.selectTUserProfileList(tUserProfile);
|
|
List<TUserProfile> list = tUserProfileService.selectTUserProfileList(tUserProfile);
|
|
return getDataTable(list);
|
|
return getDataTable(list);
|
|
@@ -62,8 +60,7 @@ public class TUserProfileController extends BaseController
|
|
* 查询用户档案列表
|
|
* 查询用户档案列表
|
|
*/
|
|
*/
|
|
@GetMapping("/listDevice")
|
|
@GetMapping("/listDevice")
|
|
- public TableDataInfo listDevice(TUserProfileDto tUserProfileDto)
|
|
|
|
- {
|
|
|
|
|
|
+ public TableDataInfo listDevice(TUserProfileDto tUserProfileDto) {
|
|
startPage();
|
|
startPage();
|
|
List<TUserProfileDto> list = tUserProfileService.selectTUserProfileListByDevice(tUserProfileDto);
|
|
List<TUserProfileDto> list = tUserProfileService.selectTUserProfileListByDevice(tUserProfileDto);
|
|
return getDataTable(list);
|
|
return getDataTable(list);
|
|
@@ -75,8 +72,7 @@ public class TUserProfileController extends BaseController
|
|
@PreAuthorize("@ss.hasPermi('system:profile:export')")
|
|
@PreAuthorize("@ss.hasPermi('system:profile:export')")
|
|
@Log(title = "用户档案", businessType = BusinessType.EXPORT)
|
|
@Log(title = "用户档案", businessType = BusinessType.EXPORT)
|
|
@PostMapping("/export")
|
|
@PostMapping("/export")
|
|
- public void export(HttpServletResponse response, TUserProfile tUserProfile)
|
|
|
|
- {
|
|
|
|
|
|
+ public void export(HttpServletResponse response, TUserProfile tUserProfile) {
|
|
List<TUserProfile> list = tUserProfileService.selectTUserProfileList(tUserProfile);
|
|
List<TUserProfile> list = tUserProfileService.selectTUserProfileList(tUserProfile);
|
|
ExcelUtil<TUserProfile> util = new ExcelUtil<TUserProfile>(TUserProfile.class);
|
|
ExcelUtil<TUserProfile> util = new ExcelUtil<TUserProfile>(TUserProfile.class);
|
|
util.exportExcel(response, list, "用户档案数据");
|
|
util.exportExcel(response, list, "用户档案数据");
|
|
@@ -87,8 +83,7 @@ public class TUserProfileController extends BaseController
|
|
*/
|
|
*/
|
|
@PreAuthorize("@ss.hasPermi('system:profile:query')")
|
|
@PreAuthorize("@ss.hasPermi('system:profile:query')")
|
|
@GetMapping(value = "/{id}")
|
|
@GetMapping(value = "/{id}")
|
|
- public AjaxResult getInfo(@PathVariable("id") Integer id)
|
|
|
|
- {
|
|
|
|
|
|
+ public AjaxResult getInfo(@PathVariable("id") Integer id) {
|
|
return success(tUserProfileService.selectTUserProfileById(id));
|
|
return success(tUserProfileService.selectTUserProfileById(id));
|
|
}
|
|
}
|
|
|
|
|
|
@@ -98,9 +93,8 @@ public class TUserProfileController extends BaseController
|
|
@PreAuthorize("@ss.hasPermi('system:profile:add')")
|
|
@PreAuthorize("@ss.hasPermi('system:profile:add')")
|
|
@Log(title = "用户档案", businessType = BusinessType.INSERT)
|
|
@Log(title = "用户档案", businessType = BusinessType.INSERT)
|
|
@PostMapping
|
|
@PostMapping
|
|
- public AjaxResult add(@RequestBody TUserProfile tUserProfile)
|
|
|
|
- {
|
|
|
|
- if (StringUtils.isNotNull(mapUrl)){
|
|
|
|
|
|
+ public AjaxResult add(@RequestBody TUserProfile tUserProfile) {
|
|
|
|
+ if (StringUtils.isNotNull(mapUrl)) {
|
|
tUserProfile.setPhoto(mapUrl.get("photoUrl"));
|
|
tUserProfile.setPhoto(mapUrl.get("photoUrl"));
|
|
tUserProfile.setOtherPhoto(mapUrl.get("otherPhotoUrl"));
|
|
tUserProfile.setOtherPhoto(mapUrl.get("otherPhotoUrl"));
|
|
}
|
|
}
|
|
@@ -109,6 +103,7 @@ public class TUserProfileController extends BaseController
|
|
|
|
|
|
/**
|
|
/**
|
|
* 资料上传请求(单个)
|
|
* 资料上传请求(单个)
|
|
|
|
+ *
|
|
* @return 集合
|
|
* @return 集合
|
|
*/
|
|
*/
|
|
@PostMapping("/photoUpload")
|
|
@PostMapping("/photoUpload")
|
|
@@ -139,16 +134,16 @@ public class TUserProfileController extends BaseController
|
|
sysDeptfileService.insertSysDeptfile(sysDeptfile);
|
|
sysDeptfileService.insertSysDeptfile(sysDeptfile);
|
|
//再添加到数据库后,得到了文件的id
|
|
//再添加到数据库后,得到了文件的id
|
|
Integer photoId = sysDeptfile.getId();
|
|
Integer photoId = sysDeptfile.getId();
|
|
- map.put("photoId",photoId);
|
|
|
|
- mapUrl.put("photoUrl",url);
|
|
|
|
|
|
+ map.put("photoId", photoId);
|
|
|
|
+ mapUrl.put("photoUrl", url);
|
|
//创建一个ajax结果,这个ajax继承map集合,相当于一个map集合
|
|
//创建一个ajax结果,这个ajax继承map集合,相当于一个map集合
|
|
AjaxResult ajax = new AjaxResult();
|
|
AjaxResult ajax = new AjaxResult();
|
|
- ajax.put("url",url);
|
|
|
|
|
|
+ ajax.put("url", url);
|
|
ajax.put("name", fname);
|
|
ajax.put("name", fname);
|
|
// ajax.put("businessId",businessId);
|
|
// ajax.put("businessId",businessId);
|
|
// ajax.put("businessFileName", fileName);
|
|
// ajax.put("businessFileName", fileName);
|
|
|
|
|
|
- return AjaxResult.success("插入成功",ajax);
|
|
|
|
|
|
+ return AjaxResult.success("插入成功", ajax);
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
return AjaxResult.error(e.getMessage());
|
|
return AjaxResult.error(e.getMessage());
|
|
}
|
|
}
|
|
@@ -156,6 +151,7 @@ public class TUserProfileController extends BaseController
|
|
|
|
|
|
/**
|
|
/**
|
|
* 资料上传请求(单个)
|
|
* 资料上传请求(单个)
|
|
|
|
+ *
|
|
* @return 集合
|
|
* @return 集合
|
|
*/
|
|
*/
|
|
@PostMapping("/otherPhotoUpload")
|
|
@PostMapping("/otherPhotoUpload")
|
|
@@ -186,16 +182,16 @@ public class TUserProfileController extends BaseController
|
|
sysDeptfileService.insertSysDeptfile(sysDeptfile);
|
|
sysDeptfileService.insertSysDeptfile(sysDeptfile);
|
|
//再添加到数据库后,得到了文件的id
|
|
//再添加到数据库后,得到了文件的id
|
|
Integer otherPhotoId = sysDeptfile.getId();
|
|
Integer otherPhotoId = sysDeptfile.getId();
|
|
- map.put("otherPhotoId",otherPhotoId);
|
|
|
|
- mapUrl.put("otherPhotoUrl",url);
|
|
|
|
|
|
+ map.put("otherPhotoId", otherPhotoId);
|
|
|
|
+ mapUrl.put("otherPhotoUrl", url);
|
|
//创建一个ajax结果,这个ajax继承map集合,相当于一个map集合
|
|
//创建一个ajax结果,这个ajax继承map集合,相当于一个map集合
|
|
AjaxResult ajax = new AjaxResult();
|
|
AjaxResult ajax = new AjaxResult();
|
|
- ajax.put("url",url);
|
|
|
|
|
|
+ ajax.put("url", url);
|
|
ajax.put("name", fname);
|
|
ajax.put("name", fname);
|
|
// ajax.put("businessId",businessId);
|
|
// ajax.put("businessId",businessId);
|
|
// ajax.put("businessFileName", fileName);
|
|
// ajax.put("businessFileName", fileName);
|
|
|
|
|
|
- return AjaxResult.success("插入成功",ajax);
|
|
|
|
|
|
+ return AjaxResult.success("插入成功", ajax);
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
return AjaxResult.error(e.getMessage());
|
|
return AjaxResult.error(e.getMessage());
|
|
}
|
|
}
|
|
@@ -207,8 +203,7 @@ public class TUserProfileController extends BaseController
|
|
@PreAuthorize("@ss.hasPermi('system:profile:edit')")
|
|
@PreAuthorize("@ss.hasPermi('system:profile:edit')")
|
|
@Log(title = "用户档案", businessType = BusinessType.UPDATE)
|
|
@Log(title = "用户档案", businessType = BusinessType.UPDATE)
|
|
@PutMapping
|
|
@PutMapping
|
|
- public AjaxResult edit(@RequestBody TUserProfile tUserProfile)
|
|
|
|
- {
|
|
|
|
|
|
+ public AjaxResult edit(@RequestBody TUserProfile tUserProfile) {
|
|
return toAjax(tUserProfileService.updateTUserProfile(tUserProfile));
|
|
return toAjax(tUserProfileService.updateTUserProfile(tUserProfile));
|
|
}
|
|
}
|
|
|
|
|
|
@@ -217,9 +212,8 @@ public class TUserProfileController extends BaseController
|
|
*/
|
|
*/
|
|
@PreAuthorize("@ss.hasPermi('system:profile:remove')")
|
|
@PreAuthorize("@ss.hasPermi('system:profile:remove')")
|
|
@Log(title = "用户档案", businessType = BusinessType.DELETE)
|
|
@Log(title = "用户档案", businessType = BusinessType.DELETE)
|
|
- @DeleteMapping("/{ids}")
|
|
|
|
- public AjaxResult remove(@PathVariable Integer[] ids)
|
|
|
|
- {
|
|
|
|
|
|
+ @DeleteMapping("/{ids}")
|
|
|
|
+ public AjaxResult remove(@PathVariable Integer[] ids) {
|
|
return toAjax(tUserProfileService.deleteTUserProfileByIds(ids));
|
|
return toAjax(tUserProfileService.deleteTUserProfileByIds(ids));
|
|
}
|
|
}
|
|
|
|
|
|
@@ -228,23 +222,35 @@ public class TUserProfileController extends BaseController
|
|
* 下载模板
|
|
* 下载模板
|
|
*/
|
|
*/
|
|
@PostMapping("/importTemplate")
|
|
@PostMapping("/importTemplate")
|
|
- public void importTemplate(HttpServletResponse response)
|
|
|
|
- {
|
|
|
|
|
|
+ public void importTemplate(HttpServletResponse response) {
|
|
ExcelUtil<TUserProfile> util = new ExcelUtil<TUserProfile>(TUserProfile.class);
|
|
ExcelUtil<TUserProfile> util = new ExcelUtil<TUserProfile>(TUserProfile.class);
|
|
util.importTemplateExcel(response, "用户档案模板");
|
|
util.importTemplateExcel(response, "用户档案模板");
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 导入
|
|
|
|
+ */
|
|
|
|
+// @Log(title = "用户档案", businessType = BusinessType.IMPORT)
|
|
|
|
+// @PostMapping("/importData")
|
|
|
|
+// @ResponseBody
|
|
|
|
+// public AjaxResult importData(MultipartFile file) throws Exception
|
|
|
|
+// {
|
|
|
|
+// ExcelUtil<TUserProfile> util = new ExcelUtil<TUserProfile>(TUserProfile.class);
|
|
|
|
+// List<TUserProfile> tUserProfileList = util.importExcel(file.getInputStream());
|
|
|
|
+// String message = tUserProfileService.importTUserProfile(tUserProfileList);
|
|
|
|
+// return AjaxResult.success(message);
|
|
|
|
+// }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 导入
|
|
* 导入
|
|
*/
|
|
*/
|
|
@Log(title = "用户档案", businessType = BusinessType.IMPORT)
|
|
@Log(title = "用户档案", businessType = BusinessType.IMPORT)
|
|
@PostMapping("/importData")
|
|
@PostMapping("/importData")
|
|
@ResponseBody
|
|
@ResponseBody
|
|
- public AjaxResult importData(MultipartFile file) throws Exception
|
|
|
|
- {
|
|
|
|
|
|
+ public AjaxResult importDataV2(MultipartFile file) throws Exception {
|
|
ExcelUtil<TUserProfile> util = new ExcelUtil<TUserProfile>(TUserProfile.class);
|
|
ExcelUtil<TUserProfile> util = new ExcelUtil<TUserProfile>(TUserProfile.class);
|
|
List<TUserProfile> tUserProfileList = util.importExcel(file.getInputStream());
|
|
List<TUserProfile> tUserProfileList = util.importExcel(file.getInputStream());
|
|
- String message = tUserProfileService.importTUserProfile(tUserProfileList);
|
|
|
|
|
|
+ String message = tUserProfileService.importTUserProfileV2(tUserProfileList);
|
|
return AjaxResult.success(message);
|
|
return AjaxResult.success(message);
|
|
}
|
|
}
|
|
}
|
|
}
|