| | |
| | | import com.gkhy.assess.common.constant.CacheConstant; |
| | | import com.gkhy.assess.common.domain.vo.AccountVO; |
| | | import com.gkhy.assess.common.domain.vo.LoginBody; |
| | | import com.gkhy.assess.common.enums.AttachTypeEnum; |
| | | import com.gkhy.assess.common.enums.UserIdentityEnum; |
| | | import com.gkhy.assess.common.enums.UserTypeEnum; |
| | | import com.gkhy.assess.common.exception.ApiException; |
| | |
| | | import com.gkhy.assess.system.domain.*; |
| | | import com.gkhy.assess.system.mapper.SysAgencyMapper; |
| | | import com.gkhy.assess.system.mapper.SysUserMapper; |
| | | import com.gkhy.assess.system.service.SysAttachService; |
| | | import com.gkhy.assess.system.service.SysConfigService; |
| | | import com.gkhy.assess.system.utils.ShiroUtils; |
| | | import com.gkhy.assess.system.service.SysUserService; |
| | |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.validation.Validator; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | |
| | |
| | | @Autowired |
| | | private SysAgencyMapper agencyMapper; |
| | | |
| | | @Autowired |
| | | private SysAttachService attachService; |
| | | |
| | | |
| | | @Override |
| | | public AccountVO login(LoginBody loginBody) { |
| | | // 验证码校验 |
| | | validateCaptcha(loginBody.getUsername(), loginBody.getCode(), loginBody.getUuid()); |
| | | // validateCaptcha(loginBody.getUsername(), loginBody.getCode(), loginBody.getUuid()); |
| | | UsernamePasswordToken usernamePasswordToken = new UsernamePasswordToken(loginBody.getUsername(), loginBody.getPassword(), false); |
| | | Subject subject= SecurityUtils.getSubject(); |
| | | String msg ; |
| | |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = RuntimeException.class) |
| | | public int addExpert(SysUser user) { |
| | | //校验用户信息 |
| | | if(!checkUsernameUnique(new SysUser().setUsername(user.getUsername()))){ |
| | |
| | | if(!b){ |
| | | throw new ApiException("创建专家信息失败"); |
| | | } |
| | | List<SysAttach> socialAttach=user.getSocialAttach(); |
| | | List<SysAttach> medicalAttach=user.getMedicalAttach(); |
| | | List<SysAttach> salaryAttach=user.getSalaryAttach(); |
| | | List<SysAttach> attaches=new ArrayList<>(); |
| | | for(SysAttach attach:socialAttach){ |
| | | attach.setType(AttachTypeEnum.SOCIAL.getCode()); |
| | | attach.setUserId(user.getId()); |
| | | attaches.add(attach); |
| | | } |
| | | for(SysAttach attach:medicalAttach){ |
| | | attach.setType(AttachTypeEnum.MEDICAL.getCode()); |
| | | attach.setUserId(user.getId()); |
| | | attaches.add(attach); |
| | | } |
| | | for(SysAttach attach:salaryAttach){ |
| | | attach.setType(AttachTypeEnum.SALARY.getCode()); |
| | | attach.setUserId(user.getId()); |
| | | attaches.add(attach); |
| | | } |
| | | attachService.saveBatch(attaches); |
| | | return 1; |
| | | } |
| | | |
| | |
| | | if(!b){ |
| | | throw new ApiException("更新专家信息失败"); |
| | | } |
| | | //刪除旧数据 |
| | | attachService.deleteAttachsByUserId(user.getId(),null); |
| | | |
| | | List<SysAttach> socialAttach=user.getSocialAttach(); |
| | | List<SysAttach> medicalAttach=user.getMedicalAttach(); |
| | | List<SysAttach> salaryAttach=user.getSalaryAttach(); |
| | | List<SysAttach> attaches=new ArrayList<>(); |
| | | for(SysAttach attach:socialAttach){ |
| | | attach.setType(AttachTypeEnum.SOCIAL.getCode()); |
| | | attach.setUserId(user.getId()); |
| | | attaches.add(attach); |
| | | } |
| | | for(SysAttach attach:medicalAttach){ |
| | | attach.setType(AttachTypeEnum.MEDICAL.getCode()); |
| | | attach.setUserId(user.getId()); |
| | | attaches.add(attach); |
| | | } |
| | | for(SysAttach attach:salaryAttach){ |
| | | attach.setType(AttachTypeEnum.SALARY.getCode()); |
| | | attach.setUserId(user.getId()); |
| | | attaches.add(attach); |
| | | } |
| | | attachService.saveBatch(attaches); |
| | | |
| | | return 1; |
| | | } |
| | | |