| | |
| | | package com.ruoyi.web.controller.zhang; |
| | | |
| | | 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.poi.ExcelUtil; |
| | | import com.ruoyi.domain.ZInfoUser; |
| | | import com.ruoyi.domain.ZfDoctor; |
| | | import com.ruoyi.domain.dto.MarryInfoDto; |
| | | import com.ruoyi.service.MarrySelfService; |
| | | import com.ruoyi.service.ZInfoUserService; |
| | | import com.ruoyi.system.service.ISysUserService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | @Resource |
| | | MarrySelfService marrySelfService; |
| | | |
| | | @Resource |
| | | ZInfoUserService zInfoUserService; |
| | | |
| | | @Autowired |
| | | private ISysUserService userService; |
| | | |
| | | //获取所有信息 |
| | | @GetMapping() |
| | | public AjaxResult getInfo(){ |
| | |
| | | //新增或修改基本信息 |
| | | @PostMapping() |
| | | public AjaxResult updateData(@RequestBody MarryInfoDto marryInfoDto){ |
| | | System.out.println("==========="); |
| | | try{ |
| | | SysUser user = SecurityUtils.getLoginUser().getUser(); |
| | | Long userId = user.getUserId(); |
| | | |
| | | ZInfoUser infoBysysId = zInfoUserService.getInfoBysysId(userId); |
| | | if(infoBysysId!=null) { |
| | | ZInfoUser zInfoUser = new ZInfoUser(); |
| | | Long spouseId = infoBysysId.getSpouseId(); |
| | | zInfoUser.setUserId(spouseId); |
| | | zInfoUser.setNickName(marryInfoDto.getSpouseName()); |
| | | if(!marryInfoDto.getSpouseSex().isEmpty()) zInfoUser.setSex(marryInfoDto.getSpouseSex().equals("男")?0:1); |
| | | zInfoUser.setBirth(marryInfoDto.getSpouseBirthday()); |
| | | zInfoUser.setNation(marryInfoDto.getSpouseNation()); |
| | | zInfoUser.setIdNum(marryInfoDto.getSpouseIdNo()); |
| | | zInfoUser.setPhoneNumber(marryInfoDto.getSpousePhone()); |
| | | zInfoUser.setMaritalStatus(marryInfoDto.getSpouseMarryStatus()); |
| | | zInfoUser.setLocationAddress(marryInfoDto.getSpouseAddress()); |
| | | zInfoUserService.updateById(zInfoUser); |
| | | |
| | | ZInfoUser spouseBysysId = zInfoUserService.getInfoById(spouseId); |
| | | if(spouseBysysId !=null) { |
| | | Long spouseUId = spouseBysysId.getSysId(); |
| | | SysUser sysUser = new SysUser(); |
| | | sysUser.setUserId(spouseUId); |
| | | sysUser.setNickName(marryInfoDto.getSpouseName()); |
| | | if (!marryInfoDto.getSpouseSex().isEmpty()) |
| | | sysUser.setSex(marryInfoDto.getSpouseSex().equals("男") ? "0" : "1"); |
| | | userService.updateUser(sysUser); |
| | | } |
| | | |
| | | }} catch (Exception e) { |
| | | e.printStackTrace(); |
| | | System.out.println("报错"+e.getMessage()); |
| | | return AjaxResult.error("更新失败"); |
| | | } |
| | | return marrySelfService.updateData(marryInfoDto); |
| | | } |
| | | |