Commit fe3f4ecf authored by zjy's avatar zjy

user/role/tright 6.18

增加了订单服务需要的提现功能
parent d351b736
package com.pangding.web.authority.controller;
import com.pangding.web.authority.service.FinanceService;
import com.pangding.web.authority.vo.reqvo.WithdrawalReqVo;
import com.pangding.web.authority.vo.resvo.WithdrawalResVo;
import com.yanzuoguang.util.helper.CheckerHelper;
import com.yanzuoguang.util.vo.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
/**
* @Author zhangjinyao
* @create 2019/6/18 19:53
*/
@RestController
@RequestMapping(value = "/finance",method = RequestMethod.POST,produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public class FinanceController {
@Autowired
private FinanceService financeServiceImpl;
@PostMapping(value = "/withdrawal")
public ResponseResult<WithdrawalResVo> withdrawal(@RequestBody WithdrawalReqVo reqVo){
CheckerHelper.newInstance()
.notBlankCheck("companyId",reqVo.getCompanyId())
.checkException();
return ResponseResult.result(financeServiceImpl.withdrawal(reqVo));
}
}
......@@ -34,9 +34,10 @@ public class AuthorityDaoImpl extends BaseDaoImpl implements AuthorityDao {
.add("id","and pid = ? ")
.add("pid","and pid = ? ")
.add("sort","and sort = ? ")
.add("levelOne","and pid = '' ");
.add("levelOne","and pid = '' order by sort asc");
table.add(GET_LEVEL_ONE,"select * from pd_authority where 1=1 ")
.add("attribute","and attribute = ?")
.add("levelOne","and pid = '' order by sort asc");
table.add(AFTER,"select * from pd_authority where 1=1 ")
......
package com.pangding.web.authority.service;
import com.pangding.web.authority.vo.reqvo.WithdrawalReqVo;
import com.pangding.web.authority.vo.resvo.WithdrawalResVo;
/**
* @Author zhangjinyao
* @create 2019/6/18 20:01
*/
public interface FinanceService {
WithdrawalResVo withdrawal(WithdrawalReqVo reqVo);
}
......@@ -74,8 +74,8 @@ public class AuthorityServiceImpl implements AuthorityService {
ObjectHelper.writeWithFrom(afterReqVo,authorityVo);
List<AuthorityVo> authorityVoList = authorityDao.after(afterReqVo);
for (AuthorityVo authorityVo2:authorityVoList) {
String sort = authorityVo2.getSort();
String newSort = (Integer.parseInt(sort)+1) + "";
Integer sort = authorityVo2.getSort();
Integer newSort = sort+1;
authorityVo2.setSort(newSort);
authorityDao.update(authorityVo2);
}
......@@ -91,8 +91,8 @@ public class AuthorityServiceImpl implements AuthorityService {
ObjectHelper.writeWithFrom(afterReqVo,authorityVo);
List<AuthorityVo> authorityVoList = authorityDao.after(afterReqVo);
for (AuthorityVo authorityVo2:authorityVoList) {
String sort = authorityVo2.getSort();
String newSort = (Integer.parseInt(sort)-1) + "";
Integer sort = authorityVo2.getSort();
Integer newSort = sort-1;
authorityVo2.setSort(newSort);
authorityDao.update(authorityVo2);
}
......
package com.pangding.web.authority.service.impl;
import com.pangding.web.authority.dao.CompanyBankCardDao;
import com.pangding.web.authority.dao.CompanyExtendDao;
import com.pangding.web.authority.service.FinanceService;
import com.pangding.web.authority.vo.CompanyBankCardVo;
import com.pangding.web.authority.vo.CompanyExtendVo;
import com.pangding.web.authority.vo.reqvo.CompanyExtendGetReqVo;
import com.pangding.web.authority.vo.reqvo.WithdrawalReqVo;
import com.pangding.web.authority.vo.resvo.WithdrawalResVo;
import com.yanzuoguang.util.exception.CodeException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @Author zhangjinyao
* @create 2019/6/18 20:01
*/
@Service
public class FinanceServiceImpl implements FinanceService {
@Autowired
private CompanyExtendDao companyExtendDaoImpl;
@Autowired
private CompanyBankCardDao companyBankCardDaoImpl;
@Override
public WithdrawalResVo withdrawal(WithdrawalReqVo reqVo) {
/*返回对象*/
WithdrawalResVo resVo = new WithdrawalResVo();
CompanyExtendGetReqVo getReqVo = new CompanyExtendGetReqVo();
getReqVo.setId(reqVo.getCompanyId());
CompanyExtendVo extendVo = companyExtendDaoImpl.load(getReqVo,CompanyExtendVo.class);
if (null == extendVo ){
throw new CodeException("未查到该公司数据");
}
resVo.setWithdrawTotalCash(extendVo.getWithdrawTotalCash());
List<CompanyBankCardVo> companyBankCardVoList = companyBankCardDaoImpl.loadList(reqVo,CompanyBankCardVo.class);
if (null == companyBankCardVoList || companyBankCardVoList.isEmpty()){
throw new CodeException("该公司暂无银行卡信息,请添加");
}
resVo.setBankCardVoList(companyBankCardVoList);
return resVo;
}
}
......@@ -27,6 +27,7 @@ import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
/**
......@@ -417,6 +418,7 @@ public class RegisterServiceImpl implements RegisterService {
levelOneList.add(authorityVo);
}
}
Collections.sort(levelOneList);
if (null == levelOneList || levelOneList.isEmpty()){
throw new CodeException("该用户暂无权限,请添加");
}
......@@ -428,6 +430,7 @@ public class RegisterServiceImpl implements RegisterService {
resVo1.setChildList(childList);
authorityListByLevel.add(resVo1);
}
Collections.sort(authorityListByLevel);
resVo.setAuthorityListByLevel(authorityListByLevel);
}
loginCompanyResVo.setBankCardCodeList(bankCardCodeList);
......@@ -450,6 +453,7 @@ public class RegisterServiceImpl implements RegisterService {
childResList.add(resVo);
}
}
Collections.sort(childResList);
return childResList;
}
......
......@@ -14,7 +14,7 @@ import java.sql.Timestamp;
* @author zhangjinyao
*/
@TableAnnotation("pd_authority")
public class AuthorityVo extends BaseVo implements InitDao {
public class AuthorityVo extends BaseVo implements InitDao,Comparable<AuthorityVo> {
private String id;
......@@ -37,13 +37,23 @@ public class AuthorityVo extends BaseVo implements InitDao {
private String createTime;
private String sort;
private Integer sort;
public String getSort() {
private Integer attribute;
public Integer getAttribute() {
return attribute;
}
public void setAttribute(Integer attribute) {
this.attribute = attribute;
}
public Integer getSort() {
return sort;
}
public void setSort(String sort) {
public void setSort(Integer sort) {
this.sort = sort;
}
......@@ -123,4 +133,9 @@ public class AuthorityVo extends BaseVo implements InitDao {
public void init() {
this.createTime = StringHelper.getFirst(this.createTime, DateHelper.getNow());
}
@Override
public int compareTo(AuthorityVo authorityVo) {
return this.sort - authorityVo.getSort();
}
}
......@@ -10,7 +10,7 @@ public class AuthorityGetReqVo {
private String pid;
private String sort;
private Integer sort;
public String getReqId() {
return reqId;
......@@ -20,11 +20,11 @@ public class AuthorityGetReqVo {
this.reqId = reqId;
}
public String getSort() {
public Integer getSort() {
return sort;
}
public void setSort(String sort) {
public void setSort(Integer sort) {
this.sort = sort;
}
......
......@@ -11,6 +11,16 @@ public class AuthorityListReqVo {
private String roleId;
private Integer attribute;
public Integer getAttribute() {
return attribute;
}
public void setAttribute(Integer attribute) {
this.attribute = attribute;
}
public String getRoleId() {
return roleId;
}
......
package com.pangding.web.authority.vo.reqvo;
/**
* @Author zhangjinyao
* @create 2019/6/18 19:57
*/
public class WithdrawalReqVo {
private String reqId;
private String companyId;
public String getReqId() {
return reqId;
}
public void setReqId(String reqId) {
this.reqId = reqId;
}
public String getCompanyId() {
return companyId;
}
public void setCompanyId(String companyId) {
this.companyId = companyId;
}
}
package com.pangding.web.authority.vo.resvo;
import com.pangding.web.authority.vo.CompanyBankCardVo;
import java.math.BigDecimal;
import java.util.List;
/**
* @Author zhangjinyao
* @create 2019/6/18 19:58
*/
public class WithdrawalResVo {
private BigDecimal withdrawTotalCash;
private List<CompanyBankCardVo> bankCardVoList;
public BigDecimal getWithdrawTotalCash() {
return withdrawTotalCash;
}
public void setWithdrawTotalCash(BigDecimal withdrawTotalCash) {
this.withdrawTotalCash = withdrawTotalCash;
}
public List<CompanyBankCardVo> getBankCardVoList() {
return bankCardVoList;
}
public void setBankCardVoList(List<CompanyBankCardVo> bankCardVoList) {
this.bankCardVoList = bankCardVoList;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment