| | |
| | | import com.panzhihua.common.model.dtos.equipment.UnionUserDto; |
| | | import com.panzhihua.common.model.vos.LoginUserInfoVO; |
| | | import com.panzhihua.common.model.vos.R; |
| | | import com.panzhihua.service_equipment.annotation.CurrentUser; |
| | | import com.panzhihua.service_equipment.model.dos.UnionUser; |
| | | import com.panzhihua.service_equipment.service.UnionUserService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Map; |
| | | |
| | | @Slf4j |
| | | @RestController |
| | |
| | | return userService.login(loginUserInfoVO); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 总工会户外劳登录(H5) |
| | | * |
| | | * @param phone |
| | | * @return 总工会户外劳共用户 |
| | | */ |
| | | @GetMapping("/loginH5") |
| | | public R<Map<String, Object>> loginH5(@RequestParam(value = "phone") String phone){ |
| | | return userService.loginByUnion(phone); |
| | | } |
| | | /** |
| | | * 总工会户外劳工站用户认证 |
| | | * |
| | |
| | | * @return 总工会户外劳共用户 |
| | | */ |
| | | @PostMapping("/authentication") |
| | | public R authentication(@RequestBody UnionUserDto unionUserDto){ |
| | | return userService.authentication(unionUserDto); |
| | | public R authentication(@RequestBody UnionUserDto unionUserDto, @CurrentUser UnionUserDto unionUser){ |
| | | if (unionUserDto.getIsApplets().equals(1)) { |
| | | log.info("小程序进入无需验证"); |
| | | return userService.authentication(unionUserDto);} |
| | | else { |
| | | log.info("h5进入"); |
| | | if (unionUser != null) { |
| | | unionUserDto.setId(unionUser.getId()); |
| | | return userService.authentication(unionUserDto);} |
| | | else { |
| | | return R.fail("请重新登录"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 使用id查找用户 |
| | | * |
| | | * @param id |
| | | * @return 总工会户外劳共用户 |
| | | */ |
| | | @GetMapping("/selectById") |
| | | public UnionUserDto selectById(@RequestParam(value = "id") Long id){ |
| | | return userService.selectById(id); |
| | | } |
| | | |
| | | } |