14 changed files with 226 additions and 0 deletions
			
			
		@ -0,0 +1,35 @@ | 
				
			|||
package com.epmet.controller; | 
				
			|||
 | 
				
			|||
import com.epmet.commons.tools.annotation.LoginUser; | 
				
			|||
import com.epmet.commons.tools.security.dto.TokenDto; | 
				
			|||
import com.epmet.commons.tools.utils.Result; | 
				
			|||
import com.epmet.dto.result.MineResultDTO; | 
				
			|||
import com.epmet.service.MineService; | 
				
			|||
import org.springframework.beans.factory.annotation.Autowired; | 
				
			|||
import org.springframework.web.bind.annotation.PostMapping; | 
				
			|||
import org.springframework.web.bind.annotation.RequestMapping; | 
				
			|||
import org.springframework.web.bind.annotation.RestController; | 
				
			|||
 | 
				
			|||
/** | 
				
			|||
 * @author zhaoqifeng | 
				
			|||
 * @dscription | 
				
			|||
 * @date 2020/5/22 17:59 | 
				
			|||
 */ | 
				
			|||
@RestController | 
				
			|||
@RequestMapping("mine") | 
				
			|||
public class MineController { | 
				
			|||
	@Autowired | 
				
			|||
	private MineService mineService; | 
				
			|||
 | 
				
			|||
	/** | 
				
			|||
	 * 我的个人信息 | 
				
			|||
	 * @author zhaoqifeng | 
				
			|||
	 * @date 2020/5/22 18:01 | 
				
			|||
	 * @param tokenDto | 
				
			|||
	 * @return com.epmet.commons.tools.utils.Result<com.epmet.dto.result.MineResultDTO> | 
				
			|||
	 */ | 
				
			|||
	@PostMapping("profile") | 
				
			|||
	public Result<MineResultDTO> profile(@LoginUser TokenDto tokenDto) { | 
				
			|||
		return new Result<MineResultDTO>().ok(mineService.profile(tokenDto)); | 
				
			|||
	} | 
				
			|||
} | 
				
			|||
@ -0,0 +1,20 @@ | 
				
			|||
package com.epmet.service; | 
				
			|||
 | 
				
			|||
import com.epmet.commons.tools.security.dto.TokenDto; | 
				
			|||
import com.epmet.dto.result.MineResultDTO; | 
				
			|||
 | 
				
			|||
/** | 
				
			|||
 * @author zhaoqifeng | 
				
			|||
 * @dscription | 
				
			|||
 * @date 2020/5/22 18:02 | 
				
			|||
 */ | 
				
			|||
public interface MineService { | 
				
			|||
	/** | 
				
			|||
	 * 我的个人信息 | 
				
			|||
	 * @author zhaoqifeng | 
				
			|||
	 * @date 2020/5/22 18:04 | 
				
			|||
	 * @param tokenDto | 
				
			|||
	 * @return com.epmet.dto.result.MineResultDTO | 
				
			|||
	 */ | 
				
			|||
	MineResultDTO profile(TokenDto tokenDto); | 
				
			|||
} | 
				
			|||
@ -0,0 +1,35 @@ | 
				
			|||
package com.epmet.service.impl; | 
				
			|||
 | 
				
			|||
import com.epmet.commons.tools.exception.EpmetErrorCode; | 
				
			|||
import com.epmet.commons.tools.exception.ErrorCode; | 
				
			|||
import com.epmet.commons.tools.exception.RenException; | 
				
			|||
import com.epmet.commons.tools.security.dto.TokenDto; | 
				
			|||
import com.epmet.commons.tools.utils.Result; | 
				
			|||
import com.epmet.dto.form.StaffInfoFromDTO; | 
				
			|||
import com.epmet.dto.result.MineResultDTO; | 
				
			|||
import com.epmet.feign.GovOrgFeignClient; | 
				
			|||
import com.epmet.service.MineService; | 
				
			|||
import org.apache.poi.ss.formula.constant.ErrorConstant; | 
				
			|||
import org.springframework.beans.factory.annotation.Autowired; | 
				
			|||
import org.springframework.stereotype.Service; | 
				
			|||
 | 
				
			|||
/** | 
				
			|||
 * @author zhaoqifeng | 
				
			|||
 * @dscription | 
				
			|||
 * @date 2020/5/22 18:03 | 
				
			|||
 */ | 
				
			|||
@Service | 
				
			|||
public class MineServiceImpl implements MineService { | 
				
			|||
	@Autowired | 
				
			|||
	GovOrgFeignClient govOrgFeignClient; | 
				
			|||
	@Override | 
				
			|||
	public MineResultDTO profile(TokenDto tokenDto) { | 
				
			|||
		StaffInfoFromDTO fromDTO = new StaffInfoFromDTO(); | 
				
			|||
		fromDTO.setStaffId(tokenDto.getUserId()); | 
				
			|||
		Result<MineResultDTO> result = govOrgFeignClient.mine(fromDTO); | 
				
			|||
		if(!result.success() || null == result.getData()) { | 
				
			|||
			throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); | 
				
			|||
		} | 
				
			|||
		return result.getData(); | 
				
			|||
	} | 
				
			|||
} | 
				
			|||
@ -0,0 +1,43 @@ | 
				
			|||
package com.epmet.dto.result; | 
				
			|||
 | 
				
			|||
import lombok.Data; | 
				
			|||
import lombok.NoArgsConstructor; | 
				
			|||
 | 
				
			|||
import java.io.Serializable; | 
				
			|||
import java.util.List; | 
				
			|||
 | 
				
			|||
/** | 
				
			|||
 * @author zhaoqifeng | 
				
			|||
 * @dscription | 
				
			|||
 * @date 2020/5/22 16:52 | 
				
			|||
 */ | 
				
			|||
@NoArgsConstructor | 
				
			|||
@Data | 
				
			|||
public class MineResultDTO implements Serializable { | 
				
			|||
 | 
				
			|||
	private static final long serialVersionUID = 8987281818368677411L; | 
				
			|||
	/** | 
				
			|||
	 * 工作人员id,后台userId | 
				
			|||
	 */ | 
				
			|||
	private String staffId; | 
				
			|||
	/** | 
				
			|||
	 * 头像 | 
				
			|||
	 */ | 
				
			|||
	private String staffHeadPhoto; | 
				
			|||
	/** | 
				
			|||
	 * 真实姓名 | 
				
			|||
	 */ | 
				
			|||
	private String realName; | 
				
			|||
	/** | 
				
			|||
	 * 性别0未知,1男2女 | 
				
			|||
	 */ | 
				
			|||
	private Integer gender; | 
				
			|||
	/** | 
				
			|||
	 * 所属机关单位名称(上级-所属) | 
				
			|||
	 */ | 
				
			|||
	private String agencyName; | 
				
			|||
	/** | 
				
			|||
	 * 角色 | 
				
			|||
	 */ | 
				
			|||
	private List<String> roleList; | 
				
			|||
} | 
				
			|||
					Loading…
					
					
				
		Reference in new issue