springData controller示例

package com.guohuai.mmp.investor.bankcard;

 

import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.data.domain.Sort.Direction;
import org.springframework.data.domain.Sort.Order;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.guohuai.basic.component.ext.web.BaseController;
import com.guohuai.basic.component.ext.web.BaseResp;
import com.guohuai.component.util.DateUtil;
import com.guohuai.component.util.DesPlus;
import com.guohuai.component.util.StringUtil;
import com.guohuai.mmp.investor.bank.BankEntity;
import com.guohuai.mmp.investor.bank.BankInfoRep;
import com.guohuai.mmp.platform.KickStarUitl;

@RestController
@RequestMapping(value = "/mimosa/investorBankCard", produces = "application/json")
public class InvestorBankCardController extends BaseController{

@Autowired
private InvestorBankCardService investorBankCardService;

/**
*
*/
@RequestMapping(value = "smng", method = RequestMethod.POST)
@ResponseBody
public ResponseEntity<InvestorBankCardListResp> smng(HttpServletRequest request,
@RequestParam int page,
@RequestParam int rows,
@RequestParam String investorOid,
@RequestParam(required = false, defaultValue = "createTime") String sort,
@RequestParam(required = false, defaultValue = "desc") String order) {
Direction sortDirection = Direction.DESC;

Pageable pageable = new PageRequest(page - 1, rows, new Sort(new Order(sortDirection, sort)));


Page<InvestorBankCardQueryEntity> formEntity = investorBankCardService.getInvestorBankCardFormData(investorOid, pageable);
InvestorBankCardListResp formListResp = new InvestorBankCardListResp(formEntity);
return new ResponseEntity<InvestorBankCardListResp>(formListResp, HttpStatus.OK);
}

/**
* 企业银行卡--解绑
* lize
*/
@RequestMapping(value = "investorBindCardRelease", method = RequestMethod.POST)
@ResponseBody
public ResponseEntity<BaseResp> investorBindCardRelease (@RequestParam String investorOid) {
BaseResp rep = this.investorBankCardService.investorReleaseCard( investorOid);
return new ResponseEntity<BaseResp>(rep, HttpStatus.OK);
}



/**
* 企业银行卡--换卡
* lize
*/
@RequestMapping(value = "investorBindCardChange", method = RequestMethod.POST)
@ResponseBody
public ResponseEntity<BaseResp> investorBindCardChange(@Valid InvestorGroupBindCardEntity req) {
BaseResp rep = this.investorBankCardService.investorChangeCard(req);
return new ResponseEntity<BaseResp>(rep, HttpStatus.OK);
}


/**
* 企业银行卡--绑卡
* lize
*/
@RequestMapping(value = "investorBindCardBind", method = RequestMethod.POST)
@ResponseBody
public ResponseEntity<BaseResp> investorBindCardBind(@Valid InvestorGroupBindCardEntity req) {

BaseResp rep = this.investorBankCardService.investorBindCard(req);
return new ResponseEntity<BaseResp>(rep, HttpStatus.OK);
}


/**
* 企业银行卡--换绑卡审核
* lize
*/
@RequestMapping(value = "ChangeAndBindCardAudit", method = RequestMethod.POST)
@ResponseBody
public ResponseEntity<BaseResp> ChangeAndBindCardAudit(@RequestParam String oid,
@RequestParam String isPass,
@RequestParam String auditAnno) {

BaseResp rep =this.investorBankCardService.ChangeAndBindCardAudit(oid,isPass,auditAnno);
return new ResponseEntity<BaseResp>(rep, HttpStatus.OK);
}

/**
* 解卡,换绑卡,是否允许
*/
@RequestMapping(value = "checkInvestorBinkOrUnlockStatus", method = RequestMethod.POST)
@ResponseBody
public ResponseEntity<String> checkInvestorBinkOrUnlockStatus(@RequestParam String investorOid) {
boolean checkFlag = this.investorBankCardService.checkInvestorBinkOrUnlockStatus(investorOid);
return new ResponseEntity<String>(String.valueOf(checkFlag), HttpStatus.OK);
}




}

posted on 2018-02-28 10:39  跳刀玛利亚  阅读(115)  评论(0编辑  收藏  举报

导航