|  | @@ -0,0 +1,156 @@
 | 
	
		
			
				|  |  | +package com.ym.mec.student.controller;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +import com.ym.mec.auth.api.client.SysUserFeignService;
 | 
	
		
			
				|  |  | +import com.ym.mec.auth.api.entity.SysUser;
 | 
	
		
			
				|  |  | +import com.ym.mec.biz.dal.dto.CashAccountDetail;
 | 
	
		
			
				|  |  | +import com.ym.mec.biz.dal.entity.StudentWithdraw;
 | 
	
		
			
				|  |  | +import com.ym.mec.biz.dal.entity.SysSuggestion;
 | 
	
		
			
				|  |  | +import com.ym.mec.biz.dal.entity.SysUserBankCard;
 | 
	
		
			
				|  |  | +import com.ym.mec.biz.service.*;
 | 
	
		
			
				|  |  | +import com.ym.mec.common.controller.BaseController;
 | 
	
		
			
				|  |  | +import com.ym.mec.common.entity.UploadReturnBean;
 | 
	
		
			
				|  |  | +import com.ym.mec.util.upload.UploadUtil;
 | 
	
		
			
				|  |  | +import io.swagger.annotations.*;
 | 
	
		
			
				|  |  | +import org.apache.commons.lang.StringUtils;
 | 
	
		
			
				|  |  | +import org.slf4j.Logger;
 | 
	
		
			
				|  |  | +import org.slf4j.LoggerFactory;
 | 
	
		
			
				|  |  | +import org.springframework.beans.factory.annotation.Autowired;
 | 
	
		
			
				|  |  | +import org.springframework.http.MediaType;
 | 
	
		
			
				|  |  | +import org.springframework.security.access.prepost.PreAuthorize;
 | 
	
		
			
				|  |  | +import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
 | 
	
		
			
				|  |  | +import org.springframework.web.bind.annotation.GetMapping;
 | 
	
		
			
				|  |  | +import org.springframework.web.bind.annotation.PostMapping;
 | 
	
		
			
				|  |  | +import org.springframework.web.bind.annotation.RequestParam;
 | 
	
		
			
				|  |  | +import org.springframework.web.bind.annotation.RestController;
 | 
	
		
			
				|  |  | +import org.springframework.web.multipart.MultipartFile;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +@Api(tags = "教师管理")
 | 
	
		
			
				|  |  | +@RestController
 | 
	
		
			
				|  |  | +public class StudentManageController extends BaseController {
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    @Autowired
 | 
	
		
			
				|  |  | +    private SysSuggestionService suggestionService;
 | 
	
		
			
				|  |  | +    @Autowired
 | 
	
		
			
				|  |  | +    private SysUserFeignService sysUserFeignService;
 | 
	
		
			
				|  |  | +    @Autowired
 | 
	
		
			
				|  |  | +    private SysUserCashAccountService sysUserCashAccountService;
 | 
	
		
			
				|  |  | +    @Autowired
 | 
	
		
			
				|  |  | +    private SysUserCashAccountDetailService sysUserCashAccountDetailService;
 | 
	
		
			
				|  |  | +    @Autowired
 | 
	
		
			
				|  |  | +    private ClassGroupService classGroupService;
 | 
	
		
			
				|  |  | +    @Autowired
 | 
	
		
			
				|  |  | +    private StudentWithdrawService studentWithdrawService;
 | 
	
		
			
				|  |  | +    @Autowired
 | 
	
		
			
				|  |  | +    private SysUserBankCardService sysUserBankCardService;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    private final static Logger LOGGER = LoggerFactory.getLogger(StudentManageController.class);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    @Autowired
 | 
	
		
			
				|  |  | +    private UploadFileService uploadFileService;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    @PostMapping(value = "uploadFile")
 | 
	
		
			
				|  |  | +    public Object uploadFile(@ApiParam(value = "上传的文件", required = true) @RequestParam("file") MultipartFile file) {
 | 
	
		
			
				|  |  | +        try {
 | 
	
		
			
				|  |  | +            if (file != null && StringUtils.isNotBlank(file.getOriginalFilename())) {
 | 
	
		
			
				|  |  | +                UploadReturnBean bean = uploadFileService.uploadFile(file.getInputStream(), UploadUtil.getExtension(file.getOriginalFilename()));
 | 
	
		
			
				|  |  | +                if (bean.isStatus()) {
 | 
	
		
			
				|  |  | +                    return succeed(bean);
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +                return failed(bean.getMessage());
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        } catch (Exception e) {
 | 
	
		
			
				|  |  | +            LOGGER.error("上传失败", e);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        return failed("上传失败");
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    @ApiOperation(value = "新增建议")
 | 
	
		
			
				|  |  | +    @PostMapping("suggestion/add")
 | 
	
		
			
				|  |  | +    public Object add(SysSuggestion SysSuggestion) {
 | 
	
		
			
				|  |  | +        suggestionService.insert(SysSuggestion);
 | 
	
		
			
				|  |  | +        return succeed();
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    @ApiOperation(value = "根据群编号,获取群组所有成员基本信息")
 | 
	
		
			
				|  |  | +    @GetMapping("classGroup/findGroupUsers")
 | 
	
		
			
				|  |  | +    @PreAuthorize("@pcs.hasPermissions('classGroup/findGroupUsers')")
 | 
	
		
			
				|  |  | +    public Object findGroupUsers(String groupId) {
 | 
	
		
			
				|  |  | +        if (org.apache.commons.lang3.StringUtils.isEmpty(groupId)) {
 | 
	
		
			
				|  |  | +            return failed("参数校验错误");
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        return succeed(classGroupService.findGroupUsers(groupId));
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    @ApiOperation(value = "获取用户账户信息")
 | 
	
		
			
				|  |  | +    @GetMapping("userCashAccount/get")
 | 
	
		
			
				|  |  | +    public Object add() {
 | 
	
		
			
				|  |  | +        SysUser sysUser = sysUserFeignService.queryUserInfo();
 | 
	
		
			
				|  |  | +        if(sysUser == null){
 | 
	
		
			
				|  |  | +            return failed("请重新登录");
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        return succeed(sysUserCashAccountService.get(sysUser.getId()));
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    @ApiOperation(value = "分页查询用户交易明细")
 | 
	
		
			
				|  |  | +    @GetMapping("userCashAccountDetail/queryPage")
 | 
	
		
			
				|  |  | +    public Object queryPage(CashAccountDetail queryInfo) {
 | 
	
		
			
				|  |  | +        SysUser user = sysUserFeignService.queryUserInfo();
 | 
	
		
			
				|  |  | +        if(user == null && user.getId() != null){
 | 
	
		
			
				|  |  | +            return failed("请重新登录");
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        queryInfo.setUserId(user.getId());
 | 
	
		
			
				|  |  | +        return succeed(sysUserCashAccountDetailService.queryPage(queryInfo));
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    @ApiOperation(value = "新增提现申请")
 | 
	
		
			
				|  |  | +    @PostMapping("/add")
 | 
	
		
			
				|  |  | +    @PreAuthorize("@pcs.hasPermissions('studentWithdraw/add')")
 | 
	
		
			
				|  |  | +    public Object add(StudentWithdraw studentWithdraw) throws Exception {
 | 
	
		
			
				|  |  | +        SysUser sysUser = sysUserFeignService.queryUserInfo();
 | 
	
		
			
				|  |  | +        if(sysUser == null && sysUser.getId() == null){
 | 
	
		
			
				|  |  | +            return failed("获取用户信息失败");
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        studentWithdraw.setUserId(sysUser.getId());
 | 
	
		
			
				|  |  | +        studentWithdrawService.add(studentWithdraw);
 | 
	
		
			
				|  |  | +        return succeed();
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    @ApiOperation(value = "新增银行卡信息")
 | 
	
		
			
				|  |  | +    @PostMapping("userBankCard/add")
 | 
	
		
			
				|  |  | +    public Object add(SysUserBankCard sysUserBankCard) {
 | 
	
		
			
				|  |  | +        if(sysUserBankCard == null){
 | 
	
		
			
				|  |  | +            return failed("参数校验异常");
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        SysUser sysUser = sysUserFeignService.queryUserInfo();
 | 
	
		
			
				|  |  | +        if(sysUser == null || sysUser.getId() == null){
 | 
	
		
			
				|  |  | +            return failed("获取用户失败");
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        sysUserBankCard.setUserId(sysUser.getId());
 | 
	
		
			
				|  |  | +        return succeed(sysUserBankCardService.add(sysUserBankCard));
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    @ApiOperation(value = "删除银行卡信息")
 | 
	
		
			
				|  |  | +    @PostMapping("userBankCard/del")
 | 
	
		
			
				|  |  | +    public Object del(Long id) {
 | 
	
		
			
				|  |  | +        if(id == null){
 | 
	
		
			
				|  |  | +            return failed("参数校验失败");
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        SysUser sysUser = sysUserFeignService.queryUserInfo();
 | 
	
		
			
				|  |  | +        if(sysUser == null || sysUser.getId() == null){
 | 
	
		
			
				|  |  | +            return failed("获取用户信息失败");
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        sysUserBankCardService.del(id,sysUser.getId());
 | 
	
		
			
				|  |  | +        return succeed();
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    @ApiOperation(value = "分页查询银行卡信息列表")
 | 
	
		
			
				|  |  | +    @GetMapping("userBankCard/queryPage")
 | 
	
		
			
				|  |  | +    public Object queryPage() {
 | 
	
		
			
				|  |  | +        SysUser sysUser = sysUserFeignService.queryUserInfo();
 | 
	
		
			
				|  |  | +        if(sysUser == null || sysUser.getId() == null){
 | 
	
		
			
				|  |  | +            return failed("获取用户失败");
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        return succeed(sysUserBankCardService.findByUser(sysUser.getId()));
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +}
 |