From 1ff85b6e1210b47d4790f866ba59fd50600b3fb4 Mon Sep 17 00:00:00 2001
From: liusheng <337615773@qq.com>
Date: 星期四, 30 十月 2025 10:49:46 +0800
Subject: [PATCH] 修改代码
---
ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceRelativesconfirmationController.java | 47 ++++++++++++++++++++++++++---------------------
1 files changed, 26 insertions(+), 21 deletions(-)
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceRelativesconfirmationController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceRelativesconfirmationController.java
index 1091173..72938a7 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceRelativesconfirmationController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceRelativesconfirmationController.java
@@ -9,6 +9,7 @@
import com.ruoyi.common.enums.Education;
import com.ruoyi.common.enums.NationalityEnum;
import com.ruoyi.common.exception.ServiceException;
+import com.ruoyi.common.exception.base.BaseException;
import com.ruoyi.project.domain.vo.RelativeConfirmationVO;
import com.ruoyi.project.mapper.ServiceDonatebaseinfoMapper;
import com.ruoyi.project.mapper.ServiceRelativesconfirmationMapper;
@@ -18,6 +19,7 @@
import freemarker.template.TemplateException;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
@@ -45,6 +47,7 @@
* @author ruoyi
* @date 2021-11-15
*/
+@Slf4j
@Api("浜插睘纭绠$悊")
@RestController
@RequestMapping("/project/relativesconfirmation")
@@ -70,7 +73,7 @@
* 鏌ヨ鎹愮尞浜插睘纭鍒楄〃
*/
@ApiOperation("鑾峰彇浜插睘纭鍒楄〃")
- //@PreAuthorize("@ss.hasPermi('project:relativesconfirmation:list')")
+ //// @PreAuthorize("@ss.hasPermi('project:relativesconfirmation:list')")
@GetMapping("/list")
public TableDataInfo list(ServiceRelativesconfirmation serviceRelativesconfirmation) {
startPage();
@@ -90,7 +93,7 @@
* 瀵煎嚭鎹愮尞浜插睘纭鍒楄〃
*/
@ApiOperation("瀵煎嚭浜插睘纭鍒楄〃")
- //@PreAuthorize("@ss.hasPermi('project:relativesconfirmation:export')")
+ //// @PreAuthorize("@ss.hasPermi('project:relativesconfirmation:export')")
@Log(title = "鎹愮尞浜插睘纭", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(ServiceRelativesconfirmation serviceRelativesconfirmation) {
@@ -103,7 +106,7 @@
* 鑾峰彇鎹愮尞浜插睘纭璇︾粏淇℃伅
*/
@ApiOperation("閫氳繃id鑾峰彇浜插睘纭淇℃伅")
- //@PreAuthorize("@ss.hasPermi('project:relativesconfirmation:query')")
+ //// @PreAuthorize("@ss.hasPermi('project:relativesconfirmation:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return AjaxResult.success(serviceRelativesconfirmationService.getById(id));
@@ -113,30 +116,36 @@
* 鏂板鎹愮尞浜插睘纭
*/
@ApiOperation("鏂板浜插睘纭")
- //@PreAuthorize("@ss.hasPermi('project:relativesconfirmation:add')")
+ //// @PreAuthorize("@ss.hasPermi('project:relativesconfirmation:add')")
@Log(title = "鎹愮尞浜插睘纭", businessType = BusinessType.INSERT)
- @PostMapping
+ @PostMapping("/add")
@RepeatSubmit
public AjaxResult add(@RequestBody ServiceRelativesconfirmation serviceRelativesconfirmation) {
- return toAjax(serviceRelativesconfirmationService.save(serviceRelativesconfirmation));
+ log.info("鏂板鎹愮尞浜插睘纭锛歿}", serviceRelativesconfirmation);
+ boolean save = serviceRelativesconfirmationService.save(serviceRelativesconfirmation);
+ return AjaxResult.success(serviceRelativesconfirmation);
}
/**
* 淇敼鎹愮尞浜插睘纭
*/
@ApiOperation("淇敼浜插睘纭")
- //@PreAuthorize("@ss.hasPermi('project:relativesconfirmation:edit')")
+ //// @PreAuthorize("@ss.hasPermi('project:relativesconfirmation:edit')")
@Log(title = "鎹愮尞浜插睘纭", businessType = BusinessType.UPDATE)
@PostMapping("/edit")
@RepeatSubmit
public AjaxResult edit(@RequestBody ServiceRelativesconfirmation serviceRelativesconfirmation) {
- ServiceRelativesconfirmation serviceRelativesconfirmation1 = new ServiceRelativesconfirmation();
- serviceRelativesconfirmation1.setInfoid(serviceRelativesconfirmation.getInfoid());
- List<ServiceRelativesconfirmation> list = serviceRelativesconfirmationService.queryList(serviceRelativesconfirmation1);
- if (CollectionUtils.isEmpty(list)) {
- return error("鎹愮尞浜插睘纭鏁版嵁涓嶅瓨鍦�,璇锋鏌ュ悗鍐嶆淇敼");
+ log.info("淇敼浜插睘纭锛歿}", serviceRelativesconfirmation);
+ if (serviceRelativesconfirmation.getInfoid() == null || serviceRelativesconfirmation.getId() == null) {
+ throw new BaseException("璇疯仈绯诲伐绋嬪笀妫�鏌D鏄惁涓虹┖");
}
- serviceRelativesconfirmation.setId(list.get(0).getId());
+// ServiceRelativesconfirmation serviceRelativesconfirmation1 = new ServiceRelativesconfirmation();
+// serviceRelativesconfirmation1.setInfoid(serviceRelativesconfirmation.getInfoid());
+// List<ServiceRelativesconfirmation> list = serviceRelativesconfirmationService.queryList(serviceRelativesconfirmation1);
+// if (CollectionUtils.isEmpty(list)) {
+// return error("鎹愮尞浜插睘纭鏁版嵁涓嶅瓨鍦�,璇锋鏌ュ悗鍐嶆淇敼");
+// }
+// serviceRelativesconfirmation.setId(list.get(0).getId());
return toAjax(serviceRelativesconfirmationService.updateById(serviceRelativesconfirmation));
}
@@ -144,7 +153,7 @@
* 鍒犻櫎鎹愮尞浜插睘纭
*/
@ApiOperation("鍒犻櫎浜插睘纭")
- //@PreAuthorize("@ss.hasPermi('project:relativesconfirmation:remove')")
+ //// @PreAuthorize("@ss.hasPermi('project:relativesconfirmation:remove')")
@Log(title = "鎹愮尞浜插睘纭", businessType = BusinessType.DELETE)
@GetMapping("/remove/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
@@ -184,17 +193,13 @@
try {
out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outFile), "utf-8"));
-
- } catch (FileNotFoundException e1) {
- e1.printStackTrace();
- }
- try {
t.process(dataMap, out);
} catch (TemplateException e) {
e.printStackTrace();
}
Map<String, Object> map = new HashMap<>();
map.put("downloadUrl", "/profile/download/wordtemplate/" + name + ".doc");
+ map.put("downloadName", name + ".doc");
return map;
}
@@ -232,8 +237,8 @@
} else if (relativeConfirmation.getSex().equals("2")) {
dataMap.put("XB", "濂�");
}
-
- dataMap.put("CSRQ", relativeConfirmation.getBirthday() == null ? "" : relativeConfirmation.getBirthday().substring(0, 10));
+ SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+ dataMap.put("CSRQ", relativeConfirmation.getBirthday() == null ? "" : simpleDateFormat.format(relativeConfirmation.getBirthday()).substring(0, 10));
dataMap.put("MZ", NationalityEnum.getDescByCode(relativeConfirmation.getNation()) == null ? "" : NationalityEnum.getDescByCode(relativeConfirmation.getNation()));
dataMap.put("XL", Education.getDescByCode(relativeConfirmation.getEducation()) == null ? "" : Education.getDescByCode(relativeConfirmation.getEducation()));
String occupation = "";
--
Gitblit v1.9.3