From 1c093829c5e7f58a04a34a831aace4b21a835250 Mon Sep 17 00:00:00 2001 From: whywhyo <1511349576@qq.com> Date: 星期一, 07 八月 2023 23:15:07 +0800 Subject: [PATCH] 15487 --- zhang-content/src/main/java/com/ruoyi/service/impl/MarryUserServiceImpl.java | 41 + zhang-content/src/main/java/com/ruoyi/service/MarryUserService.java | 6 zhang-content/src/main/java/com/ruoyi/domain/MarrySelf.java | 108 ++++ ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZMarryController.java | 156 +++--- zhang-content/src/main/java/com/ruoyi/mapper/MarrySelfMapper.java | 15 zhang-content/src/main/java/com/ruoyi/service/MarrySelfService.java | 18 ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/MarryUserController.java | 51 ++ zhang-content/src/main/java/com/ruoyi/domain/MarryUser.java | 48 - zhang-content/src/main/java/com/ruoyi/service/ZMarryService.java | 12 ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/MarrySelfController.java | 48 ++ zhang-content/src/main/java/com/ruoyi/domain/dto/MarryInfoDto.java | 135 +++- zhang-content/src/main/java/com/ruoyi/service/impl/MarrySelfServiceImpl.java | 98 ++++ zhang-content/src/main/java/com/ruoyi/service/impl/ZMarryServiceImpl.java | 578 ++++++++++++------------ zhang-content/src/main/java/com/ruoyi/domain/dto/MarryUserDto.java | 50 ++ 14 files changed, 920 insertions(+), 444 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/MarrySelfController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/MarrySelfController.java new file mode 100644 index 0000000..bde087b --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/MarrySelfController.java @@ -0,0 +1,48 @@ +package com.ruoyi.web.controller.zhang; + +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.domain.ZfDoctor; +import com.ruoyi.domain.dto.MarryInfoDto; +import com.ruoyi.service.MarrySelfService; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import java.util.ArrayList; +import java.util.List; + +/** + * @Author Jinquan_Ou + * @Description + * @Date 2023-08-07 21:26 + * @Version 1.0.0 + **/ +@RestController +@RequestMapping("/marrySelf") +public class MarrySelfController { + @Resource + MarrySelfService marrySelfService; + + //鑾峰彇鎵�鏈変俊鎭� + @GetMapping() + public AjaxResult getInfo(){ + return marrySelfService.getInfo(); + } + + //鏂板鎴栦慨鏀瑰熀鏈俊鎭� + @PostMapping() + public AjaxResult updateData(@RequestBody MarryInfoDto marryInfoDto){ + return marrySelfService.updateData(marryInfoDto); + } + + //瀵煎嚭 + @PostMapping("/export") + public void export(HttpServletResponse response){ + MarryInfoDto data = (MarryInfoDto)marrySelfService.getInfo().get("data"); + List<MarryInfoDto> marryInfoDtos = new ArrayList<>(); + marryInfoDtos.add(data); + ExcelUtil<MarryInfoDto> util = new ExcelUtil<>(MarryInfoDto.class); + util.exportExcel(response, marryInfoDtos, "涓汉濠氬Щ鏁版嵁"); + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/MarryUserController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/MarryUserController.java new file mode 100644 index 0000000..f4b59f3 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/MarryUserController.java @@ -0,0 +1,51 @@ +package com.ruoyi.web.controller.zhang; + +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.domain.MarryUser; +import com.ruoyi.service.MarrySelfService; +import com.ruoyi.service.MarryUserService; +import org.omg.CORBA.PUBLIC_MEMBER; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import javax.websocket.server.PathParam; + +/** + * @Author Jinquan_Ou + * @Description + * @Date 2023-08-07 21:30 + * @Version 1.0.0 + **/ +@RestController +@RequestMapping("/marryUser") +public class MarryUserController { + + @Resource + MarryUserService marryUserService; + + //鑾峰彇鍓嶄换淇℃伅 + @GetMapping() + public AjaxResult getInfo(){ + return marryUserService.getInfo(); + } + + //鏂板鍓嶄换 + @PostMapping() + public AjaxResult addData(@RequestBody MarryUser marryUser){ + return marryUserService.addData(marryUser); + } + + //淇敼鍓嶄换 + @PutMapping() + public AjaxResult updateData(@RequestBody MarryUser marryUser){ + return marryUserService.updateData(marryUser); + } + + //鍒犻櫎鍓嶄换 + @DeleteMapping() + public AjaxResult delete(@PathParam("id") Long id){ + marryUserService.removeById(id); + return AjaxResult.success(); + } + +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZMarryController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZMarryController.java index 58aa3e0..d6a8961 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZMarryController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZMarryController.java @@ -35,90 +35,90 @@ @RequestMapping("/zMarry") @Slf4j public class ZMarryController extends BaseController { - @Autowired - private ZMarryService zMarryService; - - - /** - * 鏌ヨ褰撳墠濠氬Щ鐘跺喌 - */ - @GetMapping("/list") - public AjaxResult getMarryStatus(){ - return zMarryService.getNow(); - } - - /** - * 鏂板濠氬Щ鐘跺喌璁板綍 - */ -// @PreAuthorize("@ss.hasPermi('system:property:add')") - @Log(title = "濠氬Щ鐘跺喌璁板綍", businessType = BusinessType.INSERT) - @PostMapping - public AjaxResult add(@RequestBody MarryInfoDto marryInfoDto) - { - return zMarryService.addInfo(marryInfoDto); - } - - /** - * 淇敼濠氬Щ鐘跺喌璁板綍 - */ -// @PreAuthorize("@ss.hasPermi('system:property:edit')") - @Log(title = "濠氬Щ鐘跺喌璁板綍", businessType = BusinessType.UPDATE) - @PutMapping - public AjaxResult edit(@RequestBody MarryInfoDto marryInfoDto) - { - return zMarryService.updateInfo(marryInfoDto); - } +// @Autowired +// private ZMarryService zMarryService; // - /** - * 鎵归噺鍒犻櫎濠氬Щ鐘跺喌璁板綍 - */ -// @PreAuthorize("@ss.hasPermi('system:property:remove')") - @Log(title = "濠氬Щ鐘跺喌璁板綍", businessType = BusinessType.DELETE) - @DeleteMapping("/{id}") - public AjaxResult remove(@PathVariable String id) - { - return zMarryService.deleteOld(id); - } - - +// // /** -// * 瀵煎嚭濠氬Щ鐘跺喌 +// * 鏌ヨ褰撳墠濠氬Щ鐘跺喌 +// */ +// @GetMapping("/list") +// public AjaxResult getMarryStatus(){ +// return zMarryService.getNow(); +// } +// +// /** +// * 鏂板濠氬Щ鐘跺喌璁板綍 +// */ +//// @PreAuthorize("@ss.hasPermi('system:property:add')") +// @Log(title = "濠氬Щ鐘跺喌璁板綍", businessType = BusinessType.INSERT) +// @PostMapping +// public AjaxResult add(@RequestBody MarryInfoDto marryInfoDto) +// { +// return zMarryService.addInfo(marryInfoDto); +// } +// +// /** +// * 淇敼濠氬Щ鐘跺喌璁板綍 +// */ +//// @PreAuthorize("@ss.hasPermi('system:property:edit')") +// @Log(title = "濠氬Щ鐘跺喌璁板綍", businessType = BusinessType.UPDATE) +// @PutMapping +// public AjaxResult edit(@RequestBody MarryInfoDto marryInfoDto) +// { +// return zMarryService.updateInfo(marryInfoDto); +// } +//// +// /** +// * 鎵归噺鍒犻櫎濠氬Щ鐘跺喌璁板綍 +// */ +//// @PreAuthorize("@ss.hasPermi('system:property:remove')") +// @Log(title = "濠氬Щ鐘跺喌璁板綍", businessType = BusinessType.DELETE) +// @DeleteMapping("/{id}") +// public AjaxResult remove(@PathVariable String id) +// { +// return zMarryService.deleteOld(id); +// } +// +// +//// /** +//// * 瀵煎嚭濠氬Щ鐘跺喌 +//// */ +//// @PostMapping("/export") +//// public void export(HttpServletResponse response) +//// { +//// AjaxResult marryStatus = getMarryStatus(); +//// HashMap data = (HashMap) marryStatus.get("data"); +//// +//// List<MarryUser> myInfoList = Arrays.asList((MarryUser) data.get("myInfo")); +//// ExcelUtil<MarryUser> util1 = new ExcelUtil<>(MarryUser.class); +//// util1.exportEasyExcel(response,myInfoList,"涓汉淇℃伅"); +//// +//// List<MarryUser> spouseInfoList = Arrays.asList((MarryUser) data.get("spouseInfo")); +//// ExcelUtil<MarryUser> util2 = new ExcelUtil<>(MarryUser.class); +//// util2.exportEasyExcel(response,spouseInfoList,"閰嶅伓淇℃伅"); +//// +//// List<ZMarry> marryInfoList = Arrays.asList((ZMarry) data.get("marryInfo")); +//// ExcelUtil<ZMarry> util3 = new ExcelUtil<>(ZMarry.class); +//// util3.exportEasyExcel(response,marryInfoList,"濠氬Щ淇℃伅"); +//// +//// List<MarryUser> oldSpouseInfoList = (List<MarryUser>) data.get("oldSpouseInfo"); +//// ExcelUtil<MarryUser> util4 = new ExcelUtil<>(MarryUser.class); +//// util4.exportEasyExcel(response,oldSpouseInfoList,"鍓嶄换淇℃伅"); +//// } +// +// +// /** +// * 瀵煎嚭 // */ // @PostMapping("/export") -// public void export(HttpServletResponse response) -// { +// public void export(HttpServletResponse response){ // AjaxResult marryStatus = getMarryStatus(); -// HashMap data = (HashMap) marryStatus.get("data"); -// -// List<MarryUser> myInfoList = Arrays.asList((MarryUser) data.get("myInfo")); -// ExcelUtil<MarryUser> util1 = new ExcelUtil<>(MarryUser.class); -// util1.exportEasyExcel(response,myInfoList,"涓汉淇℃伅"); -// -// List<MarryUser> spouseInfoList = Arrays.asList((MarryUser) data.get("spouseInfo")); -// ExcelUtil<MarryUser> util2 = new ExcelUtil<>(MarryUser.class); -// util2.exportEasyExcel(response,spouseInfoList,"閰嶅伓淇℃伅"); -// -// List<ZMarry> marryInfoList = Arrays.asList((ZMarry) data.get("marryInfo")); -// ExcelUtil<ZMarry> util3 = new ExcelUtil<>(ZMarry.class); -// util3.exportEasyExcel(response,marryInfoList,"濠氬Щ淇℃伅"); -// -// List<MarryUser> oldSpouseInfoList = (List<MarryUser>) data.get("oldSpouseInfo"); -// ExcelUtil<MarryUser> util4 = new ExcelUtil<>(MarryUser.class); -// util4.exportEasyExcel(response,oldSpouseInfoList,"鍓嶄换淇℃伅"); +// MarryInfoDto data = (MarryInfoDto) marryStatus.get("data"); +// List<MarryInfoDto> list = Arrays.asList(data); +// ExcelUtil<MarryInfoDto> util1 = new ExcelUtil<>(MarryInfoDto.class); +// util1.exportExcel(response,list,"濠氬Щ淇℃伅"); // } - - - /** - * 瀵煎嚭 - */ - @PostMapping("/export") - public void export(HttpServletResponse response){ - AjaxResult marryStatus = getMarryStatus(); - MarryInfoDto data = (MarryInfoDto) marryStatus.get("data"); - List<MarryInfoDto> list = Arrays.asList(data); - ExcelUtil<MarryInfoDto> util1 = new ExcelUtil<>(MarryInfoDto.class); - util1.exportExcel(response,list,"濠氬Щ淇℃伅"); - } } diff --git a/zhang-content/src/main/java/com/ruoyi/domain/MarrySelf.java b/zhang-content/src/main/java/com/ruoyi/domain/MarrySelf.java new file mode 100644 index 0000000..65fbbfd --- /dev/null +++ b/zhang-content/src/main/java/com/ruoyi/domain/MarrySelf.java @@ -0,0 +1,108 @@ +package com.ruoyi.domain; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.ruoyi.common.annotation.Excel; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * @Author Jinquan_Ou + * @Description + * @Date 2023-08-07 21:20 + * @Version 1.0.0 + **/ +@Data +public class MarrySelf implements Serializable { + private static final long serialVersionUID = 1L; + + private Long id; + + @Excel(name = "濮撳悕") + private String name; + + @Excel(name = "鎬у埆") + private String sex; + + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + @Excel(name = "鐢熸棩", dateFormat = "yyyy-MM-dd") + private Date birthday; + + @Excel(name = "姘戞棌") + private String nation; + + @Excel(name = "韬唤璇�") + private String idNo; + + @Excel(name = "鎵嬫満鍙风爜") + private String phone; + + @Excel(name = "濠氬Щ鐘跺喌",readConverterExp = "0=鏈,1=鍒濆,2=绂诲,3=鍐嶅") + private Integer marryStatus; + + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + @Excel(name = "缁撳鏃堕棿", dateFormat = "yyyy-MM-dd") + private Date marryTime; + + @Excel(name = "鎴风睄鍦板潃") + private String address; + + /** + * 鐢熻偛鎯呭喌,0锛氭湭鐢熻偛銆�1锛氬湪瀛曘��2锛氬凡鐢熻偛 + */ +// @Excel(name = "鐢熻偛鎯呭喌",readConverterExp = "0=鏈敓鑲�,1=鍦ㄥ瓡,2=宸茬敓鑲�") + private Integer bearStatus; + + // @Excel(name = "鏄惁棰嗗彇璁″垝鐢熻偛鏈嶅姟鎵嬪唽",readConverterExp = "0=鍚�,1=鏄�") + private Integer handbookStatus; + + @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8") +// @Excel(name = "棰嗗彇璁″垝鐢熻偛鏈嶅姟鎵嬪唽鏃堕棿", dateFormat = "yyyy-MM-dd") + private Date handbookTime; + + // @Excel(name = "鏄惁棰嗗彇鐙敓瀛愬コ璇�", readConverterExp = "0=鍚�,1=鏄�") + private Integer oneBorn; + + @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8") +// @Excel(name = "棰嗗彇鐙敓瀛愬コ璇佹椂闂�", dateFormat = "yyyy-MM-dd") + private Date oneBornTime; + + // @Excel(name = "闇�澹版槑鐨勬儏鍐�") + private String notion; + + // @Excel(name = "澶囨敞") + private String remark; + + private Long uid; + + @Excel(name = "濮撳悕") + private String spouseName; + + @Excel(name = "鎬у埆") + private String spouseSex; + + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + @Excel(name = "鐢熸棩", dateFormat = "yyyy-MM-dd") + private Date spouseBirthday; + + @Excel(name = "姘戞棌") + private String spouseNation; + + @Excel(name = "韬唤璇�") + private String spouseIdNo; + + @Excel(name = "鎵嬫満鍙风爜") + private String spousePhone; + + @Excel(name = "濠氬Щ鐘跺喌",readConverterExp = "0=鏈,1=鍒濆,2=绂诲,3=鍐嶅") + private Integer spouseMarryStatus; + + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + @Excel(name = "缁撳鏃堕棿", dateFormat = "yyyy-MM-dd") + private Date spouseMarryTime; + + @Excel(name = "鎴风睄鍦板潃") + private String spouseAddress; + +} diff --git a/zhang-content/src/main/java/com/ruoyi/domain/MarryUser.java b/zhang-content/src/main/java/com/ruoyi/domain/MarryUser.java index 8b003ce..07f151d 100644 --- a/zhang-content/src/main/java/com/ruoyi/domain/MarryUser.java +++ b/zhang-content/src/main/java/com/ruoyi/domain/MarryUser.java @@ -25,41 +25,37 @@ public class MarryUser implements Serializable { private static final long serialVersionUID = 1L; - private String id; - private Long myId; + private Long id; - @Excel(name = "濮撳悕") -// @ExcelProperty({"濮撳悕"}) + @Excel(name = "濮撳悕") private String name; + + @Excel(name = "鎬у埆") + private String sex; @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") @Excel(name = "鐢熸棩", dateFormat = "yyyy-MM-dd") -// @ExcelProperty({"鐢熸棩"}) -// @DateTimeFormat("yyyy-MM-dd") private Date birthday; - @Excel(name = "鎴风睄鍦板潃") -// @ExcelProperty({"鎴风睄鍦板潃"}) - private String address; - - @Excel(name = "韬唤璇�") -// @ExcelProperty({"宸ヤ綔鍦板潃"}) - private String idNo; - - @Excel(name = "濠氬Щ鐘跺喌",readConverterExp = "0=鏈,1=鍒濆,2=绂诲,3=鍐嶅") -// @ExcelProperty(value = {"濠氬Щ鐘跺喌"},converter = BearStatusConverter.class) - private Integer marryStatus; - - @Excel(name = "鎬у埆",readConverterExp = "0=濂�,1=鐢�") -// @ExcelProperty({"鎬у埆"}) - private Integer sex; - - @Excel(name = "姘戞棌") -// @ExcelProperty({"姘戞棌"}) + @Excel(name = "姘戞棌") private String nation; - @Excel(name = "鎵嬫満鍙风爜") -// @ExcelProperty({"鎵嬫満鍙风爜"}) + @Excel(name = "韬唤璇�") + private String idNo; + + @Excel(name = "鎴风睄鍦板潃") + private String address; + + @Excel(name = "鎵嬫満鍙风爜") private String phone; + @Excel(name = "濠氬Щ鐘跺喌",readConverterExp = "0=鏈,1=鍒濆,2=绂诲,3=鍐嶅") + private Integer marryStatus; + + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + @Excel(name = "缁撳鏃堕棿", dateFormat = "yyyy-MM-dd") + private Date marryTime; + + private Long uid; + } diff --git a/zhang-content/src/main/java/com/ruoyi/domain/dto/MarryInfoDto.java b/zhang-content/src/main/java/com/ruoyi/domain/dto/MarryInfoDto.java index fb45095..9a550d6 100644 --- a/zhang-content/src/main/java/com/ruoyi/domain/dto/MarryInfoDto.java +++ b/zhang-content/src/main/java/com/ruoyi/domain/dto/MarryInfoDto.java @@ -24,71 +24,116 @@ private static final long serialVersionUID = 1L; //鎴戜釜浜虹殑鏁版嵁 - private String id; + private Long id; // @ExcelProperty({"涓汉鏁版嵁","濮撳悕"}) @Excel(name = "涓汉濮撳悕",headerBackgroundColor = IndexedColors.YELLOW) private String name; + + // @ExcelProperty(value = {"涓汉淇℃伅","鎬у埆"}) + @Excel(name = "涓汉鎬у埆",headerBackgroundColor = IndexedColors.YELLOW) + private String sex; + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") // @ExcelProperty({"涓汉淇℃伅","鐢熸棩"}) // @DateTimeFormat("yyyy-MM-dd") @Excel(name = "涓汉鐢熸棩", dateFormat = "yyyy-MM-dd",headerBackgroundColor = IndexedColors.YELLOW) private Date birthday; - // @ExcelProperty({"涓汉淇℃伅","鎴风睄鍦板潃"}) - @Excel(name = "涓汉鎴风睄鍦板潃",headerBackgroundColor = IndexedColors.YELLOW) - private String address; - // @ExcelProperty({"涓汉淇℃伅","宸ヤ綔鍦板潃"}) - @Excel(name = "涓汉韬唤璇�",headerBackgroundColor = IndexedColors.YELLOW) - private String idNo; - // @ExcelProperty(value = {"涓汉淇℃伅","濠氬Щ鐘跺喌"},converter = BearStatusConverter.class) - @Excel(name = "涓汉濠氬Щ鐘跺喌", readConverterExp = "0=鏈,1=鍒濆,2=绂诲,3=鍐嶅",headerBackgroundColor = IndexedColors.YELLOW) - private Integer marryStatus; - // @ExcelProperty(value = {"涓汉淇℃伅","鎬у埆"}) - @Excel(name = "涓汉鎬у埆", readConverterExp = "0=濂�,1=鐢�",headerBackgroundColor = IndexedColors.YELLOW) - private Integer sex; + // @ExcelProperty(value = {"涓汉淇℃伅","姘戞棌"}) @Excel(name = "涓汉姘戞棌",headerBackgroundColor = IndexedColors.YELLOW) private String nation; + + @Excel(name = "涓汉韬唤璇�",headerBackgroundColor = IndexedColors.YELLOW) + private String idNo; + // @ExcelProperty(value = {"涓汉淇℃伅","鎵嬫満鍙风爜"}) @Excel(name = "涓汉鐢佃瘽鍙风爜",headerBackgroundColor = IndexedColors.YELLOW) private String phone; - //閰嶅伓鐨勬暟鎹� - private String spouseId; - // @ExcelProperty(value = {"閰嶅伓淇℃伅","濮撳悕"}) - @Excel(name = "閰嶅伓濮撳悕",headerBackgroundColor = IndexedColors.GREEN) - private String spouseName; + // @ExcelProperty(value = {"涓汉淇℃伅","濠氬Щ鐘跺喌"},converter = BearStatusConverter.class) + @Excel(name = "涓汉濠氬Щ鐘跺喌", readConverterExp = "0=鏈,1=鍒濆,2=绂诲,3=鍐嶅",headerBackgroundColor = IndexedColors.YELLOW) + private Integer marryStatus; + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") -// @ExcelProperty(value = {"閰嶅伓淇℃伅","鐢熸棩"}) -// @DateTimeFormat("yyyy-MM-dd") - @Excel(name = "閰嶅伓鐢熸棩", dateFormat = "yyyy-MM-dd",headerBackgroundColor = IndexedColors.GREEN) + @Excel(name = "缁撳鏃堕棿", dateFormat = "yyyy-MM-dd",headerBackgroundColor = IndexedColors.YELLOW) + private Date marryTime; + + // @ExcelProperty({"涓汉淇℃伅","鎴风睄鍦板潃"}) + @Excel(name = "涓汉鎴风睄鍦板潃",headerBackgroundColor = IndexedColors.YELLOW) + private String address; + + + @Excel(name = "閰嶅伓濮撳悕") + private String spouseName; + + @Excel(name = "閰嶅伓鎬у埆") + private String spouseSex; + + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + @Excel(name = "閰嶅伓鐢熸棩", dateFormat = "yyyy-MM-dd") private Date spouseBirthday; - // @ExcelProperty(value = {"閰嶅伓淇℃伅","鎴风睄鍦板潃"}) - @Excel(name = "閰嶅伓鎴风睄鍦板潃",headerBackgroundColor = IndexedColors.GREEN) - private String spouseAddress; - // @ExcelProperty(value = {"閰嶅伓淇℃伅","宸ヤ綔鍦板潃"}) - @Excel(name = "閰嶅伓韬唤璇�",headerBackgroundColor = IndexedColors.GREEN) - private String spouseIdNo; - // @ExcelProperty(value = {"閰嶅伓淇℃伅","濠氬Щ鐘跺喌"},converter = BearStatusConverter.class) - @Excel(name = "閰嶅伓濠氬Щ鐘跺喌", readConverterExp = "0=鏈,1=鍒濆,2=绂诲,3=鍐嶅",headerBackgroundColor = IndexedColors.GREEN) - private Integer spouseMarryStatus; - // @ExcelProperty(value = {"閰嶅伓淇℃伅","鎬у埆"}) - @Excel(name = "閰嶅伓鎬у埆", readConverterExp = "0=濂�,1=鐢�",headerBackgroundColor = IndexedColors.GREEN) - private Integer spouseSex; - // @ExcelProperty(value = {"閰嶅伓淇℃伅","姘戞棌"}) - @Excel(name = "閰嶅伓姘戞棌",headerBackgroundColor = IndexedColors.GREEN) + + @Excel(name = "閰嶅伓姘戞棌") private String spouseNation; - @Excel(name = "閰嶅伓鎵嬫満鍙风爜",headerBackgroundColor = IndexedColors.GREEN) + + @Excel(name = "閰嶅伓韬唤璇�") + private String spouseIdNo; + + @Excel(name = "閰嶅伓鎵嬫満鍙风爜") private String spousePhone; + @Excel(name = "閰嶅伓濠氬Щ鐘跺喌",readConverterExp = "0=鏈,1=鍒濆,2=绂诲,3=鍐嶅") + private Integer spouseMarryStatus; - //鐢熻偛鎯呭喌(涓棿琛�) - private Long marryId; - /** - * 缁撳鏃堕棿 - */ @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") - @Excel(name = "缁撳鏃堕棿", dateFormat = "yyyy-MM-dd") - private Date marryTime; + @Excel(name = "閰嶅伓缁撳鏃堕棿", dateFormat = "yyyy-MM-dd") + private Date spouseMarryTime; + + @Excel(name = "閰嶅伓鎴风睄鍦板潃") + private String spouseAddress; + +// //閰嶅伓鐨勬暟鎹� +// private Long spouseId; +// // @ExcelProperty(value = {"閰嶅伓淇℃伅","濮撳悕"}) +// @Excel(name = "閰嶅伓濮撳悕",headerBackgroundColor = IndexedColors.GREEN) +// private String spouseName; +// @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") +// +// // @ExcelProperty(value = {"閰嶅伓淇℃伅","鎬у埆"}) +// @Excel(name = "閰嶅伓鎬у埆", readConverterExp = "0=濂�,1=鐢�",headerBackgroundColor = IndexedColors.GREEN) +// private Integer spouseSex; +// +//// @ExcelProperty(value = {"閰嶅伓淇℃伅","鐢熸棩"}) +//// @DateTimeFormat("yyyy-MM-dd") +// @Excel(name = "閰嶅伓鐢熸棩", dateFormat = "yyyy-MM-dd",headerBackgroundColor = IndexedColors.GREEN) +// private Date spouseBirthday; +// +// // @ExcelProperty(value = {"閰嶅伓淇℃伅","姘戞棌"}) +// @Excel(name = "閰嶅伓姘戞棌",headerBackgroundColor = IndexedColors.GREEN) +// private String spouseNation; +// +// @Excel(name = "閰嶅伓韬唤璇�",headerBackgroundColor = IndexedColors.GREEN) +// private String spouseIdNo; +// +// // @ExcelProperty(value = {"閰嶅伓淇℃伅","鎴风睄鍦板潃"}) +// @Excel(name = "閰嶅伓鎴风睄鍦板潃",headerBackgroundColor = IndexedColors.GREEN) +// private String spouseAddress; +// +// @Excel(name = "閰嶅伓鎵嬫満鍙风爜",headerBackgroundColor = IndexedColors.GREEN) +// private String spousePhone; +// +// // @ExcelProperty(value = {"閰嶅伓淇℃伅","宸ヤ綔鍦板潃"}) +// +// // @ExcelProperty(value = {"閰嶅伓淇℃伅","濠氬Щ鐘跺喌"},converter = BearStatusConverter.class) +// @Excel(name = "閰嶅伓濠氬Щ鐘跺喌", readConverterExp = "0=鏈,1=鍒濆,2=绂诲,3=鍐嶅",headerBackgroundColor = IndexedColors.GREEN) +// private Integer spouseMarryStatus; +// +// @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") +// @Excel(name = "閰嶅伓缁撳鏃堕棿", dateFormat = "yyyy-MM-dd",headerBackgroundColor = IndexedColors.GREEN) +// private Date spouseMarryTime; + + + //鐢熻偛鎯呭喌 /** * 鐢熻偛鎯呭喌,0锛氭湭鐢熻偛銆�1锛氬湪瀛曘��2锛氬凡鐢熻偛 @@ -106,7 +151,7 @@ @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") private Date oneBornTime; @Excel(name = "闇�澹版槑鐨勬儏鍐�") - private String content; + private String notion; @Excel(name = "澶囨敞") private String remark; @@ -114,6 +159,6 @@ * 鍓嶄换淇℃伅鐨凩ist */ @Excel(name = "鍓嶄换淇℃伅",headerBackgroundColor= IndexedColors.RED) - private List<MarryUser> oldSpouseList; + private List<MarryUserDto> oldSpouseList; } diff --git a/zhang-content/src/main/java/com/ruoyi/domain/dto/MarryUserDto.java b/zhang-content/src/main/java/com/ruoyi/domain/dto/MarryUserDto.java new file mode 100644 index 0000000..79c434d --- /dev/null +++ b/zhang-content/src/main/java/com/ruoyi/domain/dto/MarryUserDto.java @@ -0,0 +1,50 @@ +package com.ruoyi.domain.dto; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.ruoyi.common.annotation.Excel; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * @Author Jinquan_Ou + * @Description + * @Date 2023-08-07 21:38 + * @Version 1.0.0 + **/ +@Data +public class MarryUserDto implements Serializable { + private static final long serialVersionUID = 1L; + + private Long id; + + @Excel(name = "濮撳悕") + private String name; + + @Excel(name = "鎬у埆") + private String sex; + + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + @Excel(name = "鐢熸棩", dateFormat = "yyyy-MM-dd") + private Date birthday; + + @Excel(name = "姘戞棌") + private String nation; + + @Excel(name = "韬唤璇�") + private String idNo; + + @Excel(name = "鎴风睄鍦板潃") + private String address; + + @Excel(name = "鎵嬫満鍙风爜") + private String phone; + + @Excel(name = "濠氬Щ鐘跺喌",readConverterExp = "0=鏈,1=鍒濆,2=绂诲,3=鍐嶅") + private Integer marryStatus; + + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + @Excel(name = "缁撳鏃堕棿", dateFormat = "yyyy-MM-dd") + private Date marryTime; +} diff --git a/zhang-content/src/main/java/com/ruoyi/mapper/MarrySelfMapper.java b/zhang-content/src/main/java/com/ruoyi/mapper/MarrySelfMapper.java new file mode 100644 index 0000000..d4230fd --- /dev/null +++ b/zhang-content/src/main/java/com/ruoyi/mapper/MarrySelfMapper.java @@ -0,0 +1,15 @@ +package com.ruoyi.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ruoyi.domain.MarrySelf; +import org.apache.ibatis.annotations.Mapper; + +/** + * @Author Jinquan_Ou + * @Description + * @Date 2023-08-07 21:23 + * @Version 1.0.0 + **/ +@Mapper +public interface MarrySelfMapper extends BaseMapper<MarrySelf> { +} diff --git a/zhang-content/src/main/java/com/ruoyi/service/MarrySelfService.java b/zhang-content/src/main/java/com/ruoyi/service/MarrySelfService.java new file mode 100644 index 0000000..7884e0a --- /dev/null +++ b/zhang-content/src/main/java/com/ruoyi/service/MarrySelfService.java @@ -0,0 +1,18 @@ +package com.ruoyi.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.domain.MarrySelf; +import com.ruoyi.domain.dto.MarryInfoDto; + +/** + * @Author Jinquan_Ou + * @Description + * @Date 2023-08-07 21:24 + * @Version 1.0.0 + **/ +public interface MarrySelfService extends IService<MarrySelf> { + AjaxResult getInfo(); + + AjaxResult updateData(MarryInfoDto marryInfoDto); +} diff --git a/zhang-content/src/main/java/com/ruoyi/service/MarryUserService.java b/zhang-content/src/main/java/com/ruoyi/service/MarryUserService.java index 0c5d33f..f32de2b 100644 --- a/zhang-content/src/main/java/com/ruoyi/service/MarryUserService.java +++ b/zhang-content/src/main/java/com/ruoyi/service/MarryUserService.java @@ -1,6 +1,7 @@ package com.ruoyi.service; import com.baomidou.mybatisplus.extension.service.IService; +import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.domain.MarryUser; /** @@ -10,4 +11,9 @@ * @Version 1.0.0 **/ public interface MarryUserService extends IService<MarryUser> { + AjaxResult getInfo(); + + AjaxResult addData(MarryUser marryUser); + + AjaxResult updateData(MarryUser marryUser); } diff --git a/zhang-content/src/main/java/com/ruoyi/service/ZMarryService.java b/zhang-content/src/main/java/com/ruoyi/service/ZMarryService.java index 2604d0a..c54af83 100644 --- a/zhang-content/src/main/java/com/ruoyi/service/ZMarryService.java +++ b/zhang-content/src/main/java/com/ruoyi/service/ZMarryService.java @@ -16,10 +16,10 @@ */ public interface ZMarryService extends IService<ZMarry> { - AjaxResult getNow(); - - AjaxResult addInfo(MarryInfoDto marryInfoDto); - - AjaxResult updateInfo(MarryInfoDto marryInfoDto); - AjaxResult deleteOld(String spouseId); +// AjaxResult getNow(); +// +// AjaxResult addInfo(MarryInfoDto marryInfoDto); +// +// AjaxResult updateInfo(MarryInfoDto marryInfoDto); +// AjaxResult deleteOld(String spouseId); } diff --git a/zhang-content/src/main/java/com/ruoyi/service/impl/MarrySelfServiceImpl.java b/zhang-content/src/main/java/com/ruoyi/service/impl/MarrySelfServiceImpl.java new file mode 100644 index 0000000..0bbf7d2 --- /dev/null +++ b/zhang-content/src/main/java/com/ruoyi/service/impl/MarrySelfServiceImpl.java @@ -0,0 +1,98 @@ +package com.ruoyi.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.domain.entity.SysUser; +import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.common.utils.bean.BeanUtils; +import com.ruoyi.domain.MarrySelf; +import com.ruoyi.domain.MarryUser; +import com.ruoyi.domain.dto.MarryInfoDto; +import com.ruoyi.domain.dto.MarryUserDto; +import com.ruoyi.mapper.MarrySelfMapper; +import com.ruoyi.service.MarrySelfService; +import com.ruoyi.service.MarryUserService; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.List; +import java.util.stream.Collectors; + +/** + * @Author Jinquan_Ou + * @Description + * @Date 2023-08-07 21:25 + * @Version 1.0.0 + **/ +@Service +public class MarrySelfServiceImpl extends ServiceImpl<MarrySelfMapper, MarrySelf> implements MarrySelfService { + + @Resource + MarryUserService marryUserService; + +// @Resource +// MarrySelfService marrySelfService; + + @Override + public AjaxResult getInfo() { + + //鍏堟煡璇㈣嚜宸辩殑淇℃伅 + SysUser user = SecurityUtils.getLoginUser().getUser(); + Long userId = user.getUserId(); + + LambdaQueryWrapper<MarrySelf> marrySelfLQW = new LambdaQueryWrapper<>(); + marrySelfLQW.eq(MarrySelf::getUid,userId); + MarrySelf myself = getOne(marrySelfLQW); + + if(myself == null){ + throw new RuntimeException("璇峰厛缂栬緫淇℃伅"); + } + + //鍐嶆煡璇㈠墠浠荤殑淇℃伅 + LambdaQueryWrapper<MarryUser> marryUserLQW = new LambdaQueryWrapper<>(); + marryUserLQW.eq(MarryUser::getUid,userId); + List<MarryUser> spouseList = marryUserService.list(marryUserLQW); + List<MarryUserDto> frontList = spouseList.stream().map(s -> { + MarryUserDto marryUserDto = new MarryUserDto(); + BeanUtils.copyProperties(s, marryUserDto); + return marryUserDto; + }).collect(Collectors.toList()); + + + //鏈�缁堣繑鍥炴暟鎹ā鍨� + MarryInfoDto result = new MarryInfoDto(); + BeanUtils.copyProperties(myself,result); + result.setOldSpouseList(frontList); + + return AjaxResult.success(result); + } + + @Override + public AjaxResult updateData(MarryInfoDto marryInfoDto) { + + SysUser user = SecurityUtils.getLoginUser().getUser(); + Long userId = user.getUserId(); + + MarrySelf marrySelf = new MarrySelf(); + BeanUtils.copyProperties(marryInfoDto,marrySelf); + marrySelf.setUid(userId); + + //鍏堟煡璇㈡暟鎹簱涓湁娌℃湁鏈敤鎴风殑鏁版嵁 + LambdaQueryWrapper<MarrySelf> lqw = new LambdaQueryWrapper<>(); + lqw.eq(MarrySelf::getUid,userId); + List<MarrySelf> list = list(lqw); + + if(list.isEmpty()){ + //濡傛灉鏄┖鐨勶紝閭e氨鏄柊澧� + save(marrySelf); + + }else { + //鍚﹀垯灏辨槸淇敼 + marrySelf.setId(list.get(0).getId()); + updateById(marrySelf); + } + + return AjaxResult.success(); + } +} diff --git a/zhang-content/src/main/java/com/ruoyi/service/impl/MarryUserServiceImpl.java b/zhang-content/src/main/java/com/ruoyi/service/impl/MarryUserServiceImpl.java index 20255ab..a20342c 100644 --- a/zhang-content/src/main/java/com/ruoyi/service/impl/MarryUserServiceImpl.java +++ b/zhang-content/src/main/java/com/ruoyi/service/impl/MarryUserServiceImpl.java @@ -1,10 +1,16 @@ package com.ruoyi.service.impl; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.domain.entity.SysUser; +import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.domain.MarryUser; import com.ruoyi.mapper.MarryUserMapper; import com.ruoyi.service.MarryUserService; import org.springframework.stereotype.Service; + +import java.util.List; /** * @Author Jinquan_Ou @@ -14,4 +20,39 @@ **/ @Service public class MarryUserServiceImpl extends ServiceImpl<MarryUserMapper, MarryUser> implements MarryUserService { + @Override + public AjaxResult getInfo() { + + SysUser user = SecurityUtils.getLoginUser().getUser(); + Long userId = user.getUserId(); + + LambdaQueryWrapper<MarryUser> lqw = new LambdaQueryWrapper<>(); + lqw.eq(MarryUser::getUid,userId); + List<MarryUser> frontList = list(lqw); + return AjaxResult.success(frontList); + } + + @Override + public AjaxResult addData(MarryUser marryUser) { + SysUser user = SecurityUtils.getLoginUser().getUser(); + Long userId = user.getUserId(); + + marryUser.setUid(userId); + save(marryUser); + return AjaxResult.success(); + } + + @Override + public AjaxResult updateData(MarryUser marryUser) { + SysUser user = SecurityUtils.getLoginUser().getUser(); + Long userId = user.getUserId(); + + marryUser.setUid(userId); + updateById(marryUser); + + return AjaxResult.success(); + + } + + } diff --git a/zhang-content/src/main/java/com/ruoyi/service/impl/ZMarryServiceImpl.java b/zhang-content/src/main/java/com/ruoyi/service/impl/ZMarryServiceImpl.java index 0822d3f..9f0b7e8 100644 --- a/zhang-content/src/main/java/com/ruoyi/service/impl/ZMarryServiceImpl.java +++ b/zhang-content/src/main/java/com/ruoyi/service/impl/ZMarryServiceImpl.java @@ -33,294 +33,294 @@ @Service public class ZMarryServiceImpl extends ServiceImpl<ZMarryMapper, ZMarry> implements ZMarryService { - @Resource - MarryUserService marryUserService; - - @Autowired - ZMarryServiceImpl zMarryService; - - @Override - public AjaxResult getNow() { - SysUser user = SecurityUtils.getLoginUser().getUser(); - Long userId = user.getUserId(); - - //鍏堟煡璇釜浜轰俊鎭� - LambdaQueryWrapper<MarryUser> marryUserLambdaQueryWrapper1 = new LambdaQueryWrapper<>(); - marryUserLambdaQueryWrapper1.eq(MarryUser::getMyId, userId); - MarryUser myself = marryUserService.getOne(marryUserLambdaQueryWrapper1); - - //鍐嶆煡璇腑闂磋〃淇℃伅 - if (myself == null) { - throw new RuntimeException("鎮ㄦ殏鏃惰繕鏈湪濠氬Щ琛ㄤ腑娣诲姞涓汉淇℃伅"); - } - LambdaQueryWrapper<ZMarry> zMarryLambdaQueryWrapper = new LambdaQueryWrapper<>(); - zMarryLambdaQueryWrapper.eq(ZMarry::getUserId, myself.getMyId()) - .eq(ZMarry::getDeleteStatus, 0); - ZMarry myMarryInfo = getOne(zMarryLambdaQueryWrapper);//鍙兘鏈変竴涓厤鍋� - - //鏍规嵁涓棿琛ㄤ俊鎭煡璇㈤厤鍋朵俊鎭� - if (myMarryInfo == null) { - throw new RuntimeException("鎮ㄦ殏鏃惰繕鏈湪濠氬Щ琛ㄤ腑娣诲姞濠氬Щ淇℃伅"); - } - String spouseId = myMarryInfo.getSpouseId(); - LambdaQueryWrapper<MarryUser> marryUserLambdaQueryWrapper2 = new LambdaQueryWrapper<>(); - marryUserLambdaQueryWrapper2.eq(MarryUser::getId, spouseId); - MarryUser spouse = marryUserService.getOne(marryUserLambdaQueryWrapper2); - if (spouse == null) { - throw new RuntimeException("鎮ㄦ殏鏃惰繕鏈湪濠氬Щ琛ㄤ腑娣诲姞閰嶅伓淇℃伅"); - } - - //鏍规嵁涓棿琛ㄤ俊鎭煡璇㈠墠浠讳俊鎭� - LambdaQueryWrapper<ZMarry> zMarryOldLQW = new LambdaQueryWrapper<>(); - zMarryOldLQW.eq(ZMarry::getUserId,myself.getMyId()) - .eq(ZMarry::getDeleteStatus,1); - List<ZMarry> oldList = list(zMarryOldLQW); - - //鍓嶄换淇℃伅琛� - List<MarryUser> oldSpouseList = new ArrayList<>(); - for (ZMarry zMarry : oldList) { - String spouseId1 = zMarry.getSpouseId(); - MarryUser oldSpouse = marryUserService.getById(spouseId1); - oldSpouseList.add(oldSpouse); - } - -// //缁熶竴灏佽杩斿洖 -// HashMap<String, Object> resultMap = new HashMap<>(); -// resultMap.put("myInfo",myself); -// resultMap.put("spouseInfo",spouse); -// resultMap.put("marryInfo",myMarryInfo); -// resultMap.put("oldSpouseInfo",oldSpouseList); - - //杞垚DTO杩斿洖 - MarryInfoDto marryInfoDto = MarryInfoToDto(myMarryInfo, oldSpouseList, myself, spouse); - return AjaxResult.success(marryInfoDto); - } - - private MarryInfoDto MarryInfoToDto(ZMarry myMarryInfo,List<MarryUser> oldSpouseList,MarryUser myself,MarryUser spouse){ - MarryInfoDto marryInfoDto = new MarryInfoDto(); - marryInfoDto.setId(myself.getId()); - marryInfoDto.setName(myself.getName()); - marryInfoDto.setBirthday(myself.getBirthday()); - marryInfoDto.setAddress(myself.getAddress()); - marryInfoDto.setIdNo(myself.getIdNo()); - marryInfoDto.setMarryStatus(myself.getMarryStatus()); - marryInfoDto.setSex(myself.getSex()); - marryInfoDto.setNation(myself.getNation()); - marryInfoDto.setPhone(myself.getPhone()); - - marryInfoDto.setSpouseId(spouse.getId()); - marryInfoDto.setSpouseName(spouse.getName()); - marryInfoDto.setSpouseBirthday(spouse.getBirthday()); - marryInfoDto.setSpouseAddress(spouse.getAddress()); - marryInfoDto.setSpouseIdNo(spouse.getIdNo()); - marryInfoDto.setSpouseMarryStatus(spouse.getMarryStatus()); - marryInfoDto.setSpouseSex(spouse.getSex()); - marryInfoDto.setSpouseNation(spouse.getNation()); - marryInfoDto.setSpousePhone(spouse.getPhone()); - - marryInfoDto.setMarryId(myMarryInfo.getId()); - marryInfoDto.setBearStatus(myMarryInfo.getBearStatus()); - marryInfoDto.setHandbookStatus(myMarryInfo.getHandbookStatus()); - marryInfoDto.setHandbookTime(myMarryInfo.getHandbookTime()); - marryInfoDto.setOneBorn(myMarryInfo.getOneBorn()); - marryInfoDto.setOneBornTime(myMarryInfo.getOneBornTime()); - marryInfoDto.setContent(myMarryInfo.getContent()); - marryInfoDto.setRemark(myMarryInfo.getRemark()); - marryInfoDto.setMarryTime(myMarryInfo.getMarryTime()); - - marryInfoDto.setOldSpouseList(oldSpouseList); - return marryInfoDto; - } - - - - - @Transactional - public AjaxResult addInfo(MarryInfoDto marryInfoDto){ - SysUser user = SecurityUtils.getLoginUser().getUser(); - Long userId = user.getUserId(); - - String meId= IdUtils.simpleUUID(); - String spouseId = IdUtils.simpleUUID(); - - //娣诲姞鑷繁鐨勪俊鎭� - MarryUser myself = new MarryUser(); - myself.setId(meId); - myself.setName(marryInfoDto.getName()); - myself.setBirthday(marryInfoDto.getBirthday()); - myself.setAddress(marryInfoDto.getAddress()); - myself.setIdNo(marryInfoDto.getIdNo()); - myself.setMarryStatus(marryInfoDto.getMarryStatus()); - myself.setSex(marryInfoDto.getSex()); - myself.setMyId(userId); - myself.setNation(marryInfoDto.getNation()); - myself.setPhone(marryInfoDto.getPhone()); - marryUserService.save(myself); - - //娣诲姞閰嶅伓鐨勪俊鎭� - MarryUser spouse = new MarryUser(); - spouse.setId(spouseId); - spouse.setName(marryInfoDto.getSpouseName()); - spouse.setBirthday(marryInfoDto.getSpouseBirthday()); - spouse.setAddress(marryInfoDto.getSpouseAddress()); - spouse.setIdNo(marryInfoDto.getSpouseIdNo()); - spouse.setMarryStatus(marryInfoDto.getSpouseMarryStatus()); - spouse.setSex(marryInfoDto.getSpouseSex()); - spouse.setNation(marryInfoDto.getSpouseNation()); - spouse.setPhone(marryInfoDto.getSpousePhone()); - marryUserService.save(spouse); - - //娣诲姞鐢熻偛鎯呭喌(涓棿琛�)淇℃伅 - ZMarry zMarry = new ZMarry(); - zMarry.setUserId(userId); - zMarry.setSpouseId(spouseId); - zMarry.setMarryTime(marryInfoDto.getMarryTime()); - zMarry.setBearStatus(marryInfoDto.getBearStatus()); - zMarry.setHandbookStatus(marryInfoDto.getHandbookStatus()); - zMarry.setHandbookTime(marryInfoDto.getHandbookTime()); - zMarry.setOneBorn(marryInfoDto.getOneBorn()); - zMarry.setOneBornTime(marryInfoDto.getOneBornTime()); - zMarry.setContent(marryInfoDto.getContent()); - zMarry.setRemark(marryInfoDto.getRemark()); - zMarry.setDeleteStatus(0); - zMarryService.save(zMarry); - - - List<MarryUser> oldSpouseList = marryInfoDto.getOldSpouseList(); - - //娣诲姞鍓嶄换鐨勪俊鎭� - if(oldSpouseList!=null&&oldSpouseList.size()!=0){ - for (MarryUser marryUser : oldSpouseList) { - //鍏堟坊鍔犻厤鍋剁敤鎴蜂俊鎭� - String spId = IdUtils.simpleUUID(); - marryUser.setId(spId); - marryUserService.save(marryUser); - - //鍐嶆坊鍔犱腑闂磋〃淇℃伅 - ZMarry oldMarry = new ZMarry(); - oldMarry.setUserId(userId); - oldMarry.setSpouseId(spId); - oldMarry.setDeleteStatus(1); - zMarryService.save(oldMarry); - } - } - - return AjaxResult.success(); - } - - @Transactional - public AjaxResult updateInfo(MarryInfoDto marryInfoDto){ - - SysUser user = SecurityUtils.getLoginUser().getUser(); - Long userId = user.getUserId(); - //鏇存柊鑷繁鐨勪俊鎭� - MarryUser myself = new MarryUser(); - myself.setId(marryInfoDto.getId()); - myself.setName(marryInfoDto.getName()); - myself.setBirthday(marryInfoDto.getBirthday()); - myself.setAddress(marryInfoDto.getAddress()); - myself.setIdNo(marryInfoDto.getIdNo()); - myself.setMarryStatus(marryInfoDto.getMarryStatus()); - myself.setSex(marryInfoDto.getSex()); - myself.setNation(marryInfoDto.getNation()); - myself.setPhone(marryInfoDto.getPhone()); - marryUserService.updateById(myself); - - //鏇存柊閰嶅伓鐨勪俊鎭� - - //鍏堟煡璇㈡槸鏇存柊閰嶅伓淇℃伅杩樻槸鎹㈤厤鍋讹紝鍥犱负閰嶅伓鍙兘鏈変竴涓� - //杩欓噷鏆傛椂鐢ㄥ悕瀛楁潵鍒ゆ柇鍚э紝濡傛灉鏈夐噸鍚嶇殑浜哄氨浼氭湁bug - //鍏堟煡璇� - String spouseName = marryInfoDto.getSpouseName(); - MarryUser marry = marryUserService.getById(marryInfoDto.getSpouseId()); - String marryName = marry.getName(); - if(!spouseName.equals(marryName)){ - - //濡傛灉姝e瀛愭崲浜轰簡锛屽氨鏂板鑰屼笉鏄慨鏀癸紝鍚屾椂鍒犻櫎鏃х邯褰� - //灏嗙幇鍦ㄤ腑闂磋〃鐨勫瀛愭敼鎴愬墠濡� - LambdaQueryWrapper<ZMarry> lqw = new LambdaQueryWrapper<>(); - lqw.eq(ZMarry::getUserId,userId) - .eq(ZMarry::getSpouseId,marryInfoDto.getSpouseId()); - ZMarry one = getOne(lqw); - one.setDeleteStatus(1); - zMarryService.updateById(one); - - //鏂板鐢ㄦ埛淇℃伅琛� - String spouseId = IdUtils.simpleUUID(); - MarryUser spouse = new MarryUser(); - spouse.setId(spouseId); - spouse.setName(marryInfoDto.getSpouseName()); - spouse.setBirthday(marryInfoDto.getSpouseBirthday()); - spouse.setAddress(marryInfoDto.getSpouseAddress()); - spouse.setIdNo(marryInfoDto.getSpouseIdNo()); - spouse.setMarryStatus(marryInfoDto.getSpouseMarryStatus()); - spouse.setSex(marryInfoDto.getSpouseSex()); - spouse.setNation(marryInfoDto.getSpouseNation()); - spouse.setPhone(marryInfoDto.getSpousePhone()); - marryUserService.save(spouse); - - //鏂板涓棿琛� - //娣诲姞鐢熻偛鎯呭喌(涓棿琛�)淇℃伅 - ZMarry zMarry = new ZMarry(); - zMarry.setUserId(userId); - zMarry.setSpouseId(spouseId); - zMarry.setMarryTime(marryInfoDto.getMarryTime()); - zMarry.setBearStatus(marryInfoDto.getBearStatus()); - zMarry.setHandbookStatus(marryInfoDto.getHandbookStatus()); - zMarry.setHandbookTime(marryInfoDto.getHandbookTime()); - zMarry.setOneBorn(marryInfoDto.getOneBorn()); - zMarry.setOneBornTime(marryInfoDto.getOneBornTime()); - zMarry.setContent(marryInfoDto.getContent()); - zMarry.setRemark(marryInfoDto.getRemark()); - zMarry.setDeleteStatus(0); - zMarryService.save(zMarry); - - - - }else { - - MarryUser spouse = new MarryUser(); - spouse.setId(marryInfoDto.getSpouseId()); - spouse.setName(marryInfoDto.getSpouseName()); - spouse.setBirthday(marryInfoDto.getSpouseBirthday()); - spouse.setAddress(marryInfoDto.getSpouseAddress()); - spouse.setIdNo(marryInfoDto.getSpouseIdNo()); - spouse.setMarryStatus(marryInfoDto.getSpouseMarryStatus()); - spouse.setSex(marryInfoDto.getSpouseSex()); - spouse.setNation(marryInfoDto.getSpouseNation()); - spouse.setPhone(marryInfoDto.getSpousePhone()); - marryUserService.updateById(spouse); - - //鏇存柊鐢熻偛鎯呭喌淇℃伅 - ZMarry zMarry = new ZMarry(); - zMarry.setId(marryInfoDto.getMarryId()); - zMarry.setMarryTime(marryInfoDto.getMarryTime()); - zMarry.setBearStatus(marryInfoDto.getBearStatus()); - zMarry.setHandbookStatus(marryInfoDto.getHandbookStatus()); - zMarry.setHandbookTime(marryInfoDto.getHandbookTime()); - zMarry.setOneBorn(marryInfoDto.getOneBorn()); - zMarry.setOneBornTime(marryInfoDto.getOneBornTime()); - zMarry.setContent(marryInfoDto.getContent()); - zMarry.setRemark(marryInfoDto.getRemark()); - zMarry.setDeleteStatus(0); - zMarryService.updateById(zMarry); - } - - //鏇存柊鍓嶄换淇℃伅 - List<MarryUser> oldSpouseList = marryInfoDto.getOldSpouseList(); - if(oldSpouseList!=null&&oldSpouseList.size()!=0){ - for (MarryUser marryUser : oldSpouseList) { - //淇敼鐢ㄦ埛鍓嶄换淇℃伅 - marryUserService.updateById(marryUser); - //涓棿琛ㄤ笉闇�瑕佷慨鏀� - } - } - return AjaxResult.success(); - } - - public AjaxResult deleteOld(String spouseId){ - marryUserService.removeById(spouseId); - return AjaxResult.success(); - } +// @Resource +// MarryUserService marryUserService; +// +// @Autowired +// ZMarryServiceImpl zMarryService; +// +// @Override +// public AjaxResult getNow() { +// SysUser user = SecurityUtils.getLoginUser().getUser(); +// Long userId = user.getUserId(); +// +// //鍏堟煡璇釜浜轰俊鎭� +// LambdaQueryWrapper<MarryUser> marryUserLambdaQueryWrapper1 = new LambdaQueryWrapper<>(); +// marryUserLambdaQueryWrapper1.eq(MarryUser::getMyId, userId); +// MarryUser myself = marryUserService.getOne(marryUserLambdaQueryWrapper1); +// +// //鍐嶆煡璇腑闂磋〃淇℃伅 +// if (myself == null) { +// throw new RuntimeException("鎮ㄦ殏鏃惰繕鏈湪濠氬Щ琛ㄤ腑娣诲姞涓汉淇℃伅"); +// } +// LambdaQueryWrapper<ZMarry> zMarryLambdaQueryWrapper = new LambdaQueryWrapper<>(); +// zMarryLambdaQueryWrapper.eq(ZMarry::getUserId, myself.getMyId()) +// .eq(ZMarry::getDeleteStatus, 0); +// ZMarry myMarryInfo = getOne(zMarryLambdaQueryWrapper);//鍙兘鏈変竴涓厤鍋� +// +// //鏍规嵁涓棿琛ㄤ俊鎭煡璇㈤厤鍋朵俊鎭� +// if (myMarryInfo == null) { +// throw new RuntimeException("鎮ㄦ殏鏃惰繕鏈湪濠氬Щ琛ㄤ腑娣诲姞濠氬Щ淇℃伅"); +// } +// String spouseId = myMarryInfo.getSpouseId(); +// LambdaQueryWrapper<MarryUser> marryUserLambdaQueryWrapper2 = new LambdaQueryWrapper<>(); +// marryUserLambdaQueryWrapper2.eq(MarryUser::getId, spouseId); +// MarryUser spouse = marryUserService.getOne(marryUserLambdaQueryWrapper2); +// if (spouse == null) { +// throw new RuntimeException("鎮ㄦ殏鏃惰繕鏈湪濠氬Щ琛ㄤ腑娣诲姞閰嶅伓淇℃伅"); +// } +// +// //鏍规嵁涓棿琛ㄤ俊鎭煡璇㈠墠浠讳俊鎭� +// LambdaQueryWrapper<ZMarry> zMarryOldLQW = new LambdaQueryWrapper<>(); +// zMarryOldLQW.eq(ZMarry::getUserId,myself.getMyId()) +// .eq(ZMarry::getDeleteStatus,1); +// List<ZMarry> oldList = list(zMarryOldLQW); +// +// //鍓嶄换淇℃伅琛� +// List<MarryUser> oldSpouseList = new ArrayList<>(); +// for (ZMarry zMarry : oldList) { +// String spouseId1 = zMarry.getSpouseId(); +// MarryUser oldSpouse = marryUserService.getById(spouseId1); +// oldSpouseList.add(oldSpouse); +// } +// +//// //缁熶竴灏佽杩斿洖 +//// HashMap<String, Object> resultMap = new HashMap<>(); +//// resultMap.put("myInfo",myself); +//// resultMap.put("spouseInfo",spouse); +//// resultMap.put("marryInfo",myMarryInfo); +//// resultMap.put("oldSpouseInfo",oldSpouseList); +// +// //杞垚DTO杩斿洖 +// MarryInfoDto marryInfoDto = MarryInfoToDto(myMarryInfo, oldSpouseList, myself, spouse); +// return AjaxResult.success(marryInfoDto); +// } +// +// private MarryInfoDto MarryInfoToDto(ZMarry myMarryInfo,List<MarryUser> oldSpouseList,MarryUser myself,MarryUser spouse){ +// MarryInfoDto marryInfoDto = new MarryInfoDto(); +// marryInfoDto.setId(myself.getId()); +// marryInfoDto.setName(myself.getName()); +// marryInfoDto.setBirthday(myself.getBirthday()); +// marryInfoDto.setAddress(myself.getAddress()); +// marryInfoDto.setIdNo(myself.getIdNo()); +// marryInfoDto.setMarryStatus(myself.getMarryStatus()); +// marryInfoDto.setSex(myself.getSex()); +// marryInfoDto.setNation(myself.getNation()); +// marryInfoDto.setPhone(myself.getPhone()); +// +// marryInfoDto.setSpouseId(spouse.getId()); +// marryInfoDto.setSpouseName(spouse.getName()); +// marryInfoDto.setSpouseBirthday(spouse.getBirthday()); +// marryInfoDto.setSpouseAddress(spouse.getAddress()); +// marryInfoDto.setSpouseIdNo(spouse.getIdNo()); +// marryInfoDto.setSpouseMarryStatus(spouse.getMarryStatus()); +// marryInfoDto.setSpouseSex(spouse.getSex()); +// marryInfoDto.setSpouseNation(spouse.getNation()); +// marryInfoDto.setSpousePhone(spouse.getPhone()); +// +// marryInfoDto.setMarryId(myMarryInfo.getId()); +// marryInfoDto.setBearStatus(myMarryInfo.getBearStatus()); +// marryInfoDto.setHandbookStatus(myMarryInfo.getHandbookStatus()); +// marryInfoDto.setHandbookTime(myMarryInfo.getHandbookTime()); +// marryInfoDto.setOneBorn(myMarryInfo.getOneBorn()); +// marryInfoDto.setOneBornTime(myMarryInfo.getOneBornTime()); +// marryInfoDto.setContent(myMarryInfo.getContent()); +// marryInfoDto.setRemark(myMarryInfo.getRemark()); +// marryInfoDto.setMarryTime(myMarryInfo.getMarryTime()); +// +// marryInfoDto.setOldSpouseList(oldSpouseList); +// return marryInfoDto; +// } +// +// +// +// +// @Transactional +// public AjaxResult addInfo(MarryInfoDto marryInfoDto){ +// SysUser user = SecurityUtils.getLoginUser().getUser(); +// Long userId = user.getUserId(); +// +// String meId= IdUtils.simpleUUID(); +// String spouseId = IdUtils.simpleUUID(); +// +// //娣诲姞鑷繁鐨勪俊鎭� +// MarryUser myself = new MarryUser(); +// myself.setId(meId); +// myself.setName(marryInfoDto.getName()); +// myself.setBirthday(marryInfoDto.getBirthday()); +// myself.setAddress(marryInfoDto.getAddress()); +// myself.setIdNo(marryInfoDto.getIdNo()); +// myself.setMarryStatus(marryInfoDto.getMarryStatus()); +// myself.setSex(marryInfoDto.getSex()); +// myself.setMyId(userId); +// myself.setNation(marryInfoDto.getNation()); +// myself.setPhone(marryInfoDto.getPhone()); +// marryUserService.save(myself); +// +// //娣诲姞閰嶅伓鐨勪俊鎭� +// MarryUser spouse = new MarryUser(); +// spouse.setId(spouseId); +// spouse.setName(marryInfoDto.getSpouseName()); +// spouse.setBirthday(marryInfoDto.getSpouseBirthday()); +// spouse.setAddress(marryInfoDto.getSpouseAddress()); +// spouse.setIdNo(marryInfoDto.getSpouseIdNo()); +// spouse.setMarryStatus(marryInfoDto.getSpouseMarryStatus()); +// spouse.setSex(marryInfoDto.getSpouseSex()); +// spouse.setNation(marryInfoDto.getSpouseNation()); +// spouse.setPhone(marryInfoDto.getSpousePhone()); +// marryUserService.save(spouse); +// +// //娣诲姞鐢熻偛鎯呭喌(涓棿琛�)淇℃伅 +// ZMarry zMarry = new ZMarry(); +// zMarry.setUserId(userId); +// zMarry.setSpouseId(spouseId); +// zMarry.setMarryTime(marryInfoDto.getMarryTime()); +// zMarry.setBearStatus(marryInfoDto.getBearStatus()); +// zMarry.setHandbookStatus(marryInfoDto.getHandbookStatus()); +// zMarry.setHandbookTime(marryInfoDto.getHandbookTime()); +// zMarry.setOneBorn(marryInfoDto.getOneBorn()); +// zMarry.setOneBornTime(marryInfoDto.getOneBornTime()); +// zMarry.setContent(marryInfoDto.getContent()); +// zMarry.setRemark(marryInfoDto.getRemark()); +// zMarry.setDeleteStatus(0); +// zMarryService.save(zMarry); +// +// +// List<MarryUser> oldSpouseList = marryInfoDto.getOldSpouseList(); +// +// //娣诲姞鍓嶄换鐨勪俊鎭� +// if(oldSpouseList!=null&&oldSpouseList.size()!=0){ +// for (MarryUser marryUser : oldSpouseList) { +// //鍏堟坊鍔犻厤鍋剁敤鎴蜂俊鎭� +// String spId = IdUtils.simpleUUID(); +// marryUser.setId(spId); +// marryUserService.save(marryUser); +// +// //鍐嶆坊鍔犱腑闂磋〃淇℃伅 +// ZMarry oldMarry = new ZMarry(); +// oldMarry.setUserId(userId); +// oldMarry.setSpouseId(spId); +// oldMarry.setDeleteStatus(1); +// zMarryService.save(oldMarry); +// } +// } +// +// return AjaxResult.success(); +// } +// +// @Transactional +// public AjaxResult updateInfo(MarryInfoDto marryInfoDto){ +// +// SysUser user = SecurityUtils.getLoginUser().getUser(); +// Long userId = user.getUserId(); +// //鏇存柊鑷繁鐨勪俊鎭� +// MarryUser myself = new MarryUser(); +// myself.setId(marryInfoDto.getId()); +// myself.setName(marryInfoDto.getName()); +// myself.setBirthday(marryInfoDto.getBirthday()); +// myself.setAddress(marryInfoDto.getAddress()); +// myself.setIdNo(marryInfoDto.getIdNo()); +// myself.setMarryStatus(marryInfoDto.getMarryStatus()); +// myself.setSex(marryInfoDto.getSex()); +// myself.setNation(marryInfoDto.getNation()); +// myself.setPhone(marryInfoDto.getPhone()); +// marryUserService.updateById(myself); +// +// //鏇存柊閰嶅伓鐨勪俊鎭� +// +// //鍏堟煡璇㈡槸鏇存柊閰嶅伓淇℃伅杩樻槸鎹㈤厤鍋讹紝鍥犱负閰嶅伓鍙兘鏈変竴涓� +// //杩欓噷鏆傛椂鐢ㄥ悕瀛楁潵鍒ゆ柇鍚э紝濡傛灉鏈夐噸鍚嶇殑浜哄氨浼氭湁bug +// //鍏堟煡璇� +// String spouseName = marryInfoDto.getSpouseName(); +// MarryUser marry = marryUserService.getById(marryInfoDto.getSpouseId()); +// String marryName = marry.getName(); +// if(!spouseName.equals(marryName)){ +// +// //濡傛灉姝e瀛愭崲浜轰簡锛屽氨鏂板鑰屼笉鏄慨鏀癸紝鍚屾椂鍒犻櫎鏃х邯褰� +// //灏嗙幇鍦ㄤ腑闂磋〃鐨勫瀛愭敼鎴愬墠濡� +// LambdaQueryWrapper<ZMarry> lqw = new LambdaQueryWrapper<>(); +// lqw.eq(ZMarry::getUserId,userId) +// .eq(ZMarry::getSpouseId,marryInfoDto.getSpouseId()); +// ZMarry one = getOne(lqw); +// one.setDeleteStatus(1); +// zMarryService.updateById(one); +// +// //鏂板鐢ㄦ埛淇℃伅琛� +// String spouseId = IdUtils.simpleUUID(); +// MarryUser spouse = new MarryUser(); +// spouse.setId(spouseId); +// spouse.setName(marryInfoDto.getSpouseName()); +// spouse.setBirthday(marryInfoDto.getSpouseBirthday()); +// spouse.setAddress(marryInfoDto.getSpouseAddress()); +// spouse.setIdNo(marryInfoDto.getSpouseIdNo()); +// spouse.setMarryStatus(marryInfoDto.getSpouseMarryStatus()); +// spouse.setSex(marryInfoDto.getSpouseSex()); +// spouse.setNation(marryInfoDto.getSpouseNation()); +// spouse.setPhone(marryInfoDto.getSpousePhone()); +// marryUserService.save(spouse); +// +// //鏂板涓棿琛� +// //娣诲姞鐢熻偛鎯呭喌(涓棿琛�)淇℃伅 +// ZMarry zMarry = new ZMarry(); +// zMarry.setUserId(userId); +// zMarry.setSpouseId(spouseId); +// zMarry.setMarryTime(marryInfoDto.getMarryTime()); +// zMarry.setBearStatus(marryInfoDto.getBearStatus()); +// zMarry.setHandbookStatus(marryInfoDto.getHandbookStatus()); +// zMarry.setHandbookTime(marryInfoDto.getHandbookTime()); +// zMarry.setOneBorn(marryInfoDto.getOneBorn()); +// zMarry.setOneBornTime(marryInfoDto.getOneBornTime()); +// zMarry.setContent(marryInfoDto.getContent()); +// zMarry.setRemark(marryInfoDto.getRemark()); +// zMarry.setDeleteStatus(0); +// zMarryService.save(zMarry); +// +// +// +// }else { +// +// MarryUser spouse = new MarryUser(); +// spouse.setId(marryInfoDto.getSpouseId()); +// spouse.setName(marryInfoDto.getSpouseName()); +// spouse.setBirthday(marryInfoDto.getSpouseBirthday()); +// spouse.setAddress(marryInfoDto.getSpouseAddress()); +// spouse.setIdNo(marryInfoDto.getSpouseIdNo()); +// spouse.setMarryStatus(marryInfoDto.getSpouseMarryStatus()); +// spouse.setSex(marryInfoDto.getSpouseSex()); +// spouse.setNation(marryInfoDto.getSpouseNation()); +// spouse.setPhone(marryInfoDto.getSpousePhone()); +// marryUserService.updateById(spouse); +// +// //鏇存柊鐢熻偛鎯呭喌淇℃伅 +// ZMarry zMarry = new ZMarry(); +// zMarry.setId(marryInfoDto.getMarryId()); +// zMarry.setMarryTime(marryInfoDto.getMarryTime()); +// zMarry.setBearStatus(marryInfoDto.getBearStatus()); +// zMarry.setHandbookStatus(marryInfoDto.getHandbookStatus()); +// zMarry.setHandbookTime(marryInfoDto.getHandbookTime()); +// zMarry.setOneBorn(marryInfoDto.getOneBorn()); +// zMarry.setOneBornTime(marryInfoDto.getOneBornTime()); +// zMarry.setContent(marryInfoDto.getContent()); +// zMarry.setRemark(marryInfoDto.getRemark()); +// zMarry.setDeleteStatus(0); +// zMarryService.updateById(zMarry); +// } +// +// //鏇存柊鍓嶄换淇℃伅 +// List<MarryUser> oldSpouseList = marryInfoDto.getOldSpouseList(); +// if(oldSpouseList!=null&&oldSpouseList.size()!=0){ +// for (MarryUser marryUser : oldSpouseList) { +// //淇敼鐢ㄦ埛鍓嶄换淇℃伅 +// marryUserService.updateById(marryUser); +// //涓棿琛ㄤ笉闇�瑕佷慨鏀� +// } +// } +// return AjaxResult.success(); +// } +// +// public AjaxResult deleteOld(String spouseId){ +// marryUserService.removeById(spouseId); +// return AjaxResult.success(); +// } } -- Gitblit v1.9.1