Authored by mingdan.ge

cps三期

... ... @@ -13,24 +13,24 @@ import java.util.Map;
public enum BankEnum {
//邮政储蓄,工商银行
gs("gs","中国工商银行"),
ny("ny","中国农业银行"),
zh("zh","中国银行"),
js("js","中国建设银行"),
jt("jt","交通银行"),
yzcx("yzcx","中国邮政储蓄银行"),
zs("zs","招商银行"),
pdfz("pdfz","上海浦东发展银行"),
zx("zx","中信银行"),
gd("gd","中国光大银行"),
hx("hx","华夏银行"),
ms("ms","中国民生银行"),
gf("gf","广发银行"),
xy("xy","兴业银行"),
pa("pa","平安银行"),
hf("hf","恒丰银行"),
zhes("zhes","浙商银行"),
bh("bh","渤海银行");
zggsyh("zggsyh","中国工商银行"),
zgnyyh("zgnyyh","中国农业银行"),
zgyh("zgyh","中国银行"),
zgjsyh("zgjsyh","中国建设银行"),
jtyh("jtyh","交通银行"),
zgyzcxyh("zgyzcxyh","中国邮政储蓄银行"),
zsyh("zsyh","招商银行"),
shpdfzyh("shpdfzyh","上海浦东发展银行"),
zxyh("zxyh","中信银行"),
zggdyh("zggdyh","中国光大银行"),
hxyh("hxyh","华夏银行"),
zgmsyh("zgmsyh","中国民生银行"),
gfyh("gfyh","广发银行"),
xyyh("xyyh","兴业银行"),
payh("payh","平安银行"),
hfyh("hfyh","恒丰银行"),
zsyh2("zsyh2","浙商银行"),
bhyh("bhyh","渤海银行");
private String code;
private String bankName;
... ... @@ -68,6 +68,28 @@ public enum BankEnum {
return bankList;
}
public static List<UnionShareBankBo> getAllBankAsc(){
List<UnionShareBankBo> bankList = new ArrayList<>();
ascBankCode(bankList,getAllBankMap());
return bankList;
}
private static void ascBankCode(List<UnionShareBankBo> bankList,Map<String, String> bankMap) {
if (bankMap.isEmpty()) {
return;
}
UnionShareBankBo bo = new UnionShareBankBo();
bankMap.forEach((k,v)->{
if (bo.getBankCode() == null||k.compareToIgnoreCase(bo.getBankCode())<0) {
bo.setBankCode(k);
}
});
bo.setBankName(bankMap.get(bo.getBankCode()));
bankMap.remove(bo.getBankCode());
bankList.add(bo);
ascBankCode(bankList,bankMap);
}
public String getCode() {
return code;
}
... ...
... ... @@ -12,9 +12,11 @@ import java.util.Map;
public enum SocialMediaTypeEnum {
//社交媒体:1-微信公众号,2-抖音
wechat(1,"微信公众号"),
douyin(2,"抖音"),
weibo(3,"微博");
wechat(1,"微信"),
wechat2(2,"微信订阅号"),
douyin(3,"抖音"),
weibo(4,"微博"),
instagram(5,"instagram");
private int type;
private String name;
... ... @@ -42,13 +44,16 @@ public enum SocialMediaTypeEnum {
return jsonArray;
}
public static String getNameByType(int type) {
public static String getNameByType(Integer type) {
if (type == null) {
return "";
}
for (SocialMediaTypeEnum e : values()) {
if (e.getType() == type) {
return e.getName();
}
}
return null;
return type+"";
}
public int getType() {
... ...
... ... @@ -2,6 +2,8 @@ package com.yoho.unions.server.restapi;
import com.alibaba.fastjson.JSONArray;
import com.yoho.core.common.utils.JsonUtil;
import com.yoho.error.ServiceError;
import com.yoho.error.exception.ServiceException;
import com.yoho.service.model.union.bo.*;
import com.yoho.service.model.union.request.*;
import com.yoho.service.model.union.response.*;
... ... @@ -123,7 +125,10 @@ public class UnionShareRest {
public UnionResponse bindBankCard(@RequestBody UnionShareUserBankBo bo){
log.info("UnionShareRest.bindBankCard req is {}", bo);
int result = unionShareService.bindBankCard(bo);
return new UnionResponse(200, "bindBankCard success",result>0?"Y":"N");
if (result > 0) {
return new UnionResponse(200, "bindBankCard success",bo);
}
throw new ServiceException(ServiceError.UNION_BINK_BANK_CARD_ERROR);
}
/**
... ... @@ -135,8 +140,8 @@ public class UnionShareRest {
@ResponseBody
public UnionResponse checkBankCard(@RequestBody UnionShareUserBankBo bo){
log.info("UnionShareRest.checkBankCard req is {}", bo);
int result = unionShareService.checkAndBuildBankCard(bo);
return new UnionResponse(200, "checkBankCard success",result>0?"Y":"N");
UnionShareUserBankBo result = unionShareService.checkAndBuildBankCard(bo);
return new UnionResponse(200, "checkBankCard success",result);
}
/**
* 查询绑定的银行卡
... ...
... ... @@ -93,7 +93,7 @@ public interface IUnionShareService {
* @param bo
* @return
*/
int checkAndBuildBankCard(UnionShareUserBankBo bo);
UnionShareUserBankBo checkAndBuildBankCard(UnionShareUserBankBo bo);
/**
* 用户前台获取个人推广近期订单(10个)
... ...
... ... @@ -48,9 +48,12 @@ public class UnionShareApplyExportImpl implements IBusinessExportService {
List<SocialMediaBo> socialMediaBos = JsonUtil.jsonToList(bo.getSocialMedia(), SocialMediaBo.class);
StringBuilder socialMediaBuilder = new StringBuilder();
socialMediaBos.forEach(s->{
socialMediaBuilder.append(SocialMediaTypeEnum.getNameByType(s.getSocialMediaType()));
socialMediaBuilder.append("("+s.getSocialMediaAccount()+"):");
socialMediaBuilder.append(s.getSocialMediaFans());
if (s.getType() == null) {
return;
}
socialMediaBuilder.append(SocialMediaTypeEnum.getNameByType(s.getType()));
socialMediaBuilder.append("("+s.getAccount()+"):");
socialMediaBuilder.append(s.getFans());
socialMediaBuilder.append("\n\r");
});
bo.setSocialMedia(socialMediaBuilder.toString());
... ...
... ... @@ -302,9 +302,12 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport
List<SocialMediaBo> socialMediaBos = JsonUtil.jsonToList(bo.getSocialMedia(), SocialMediaBo.class);
StringBuilder socialMediaBuilder = new StringBuilder();
socialMediaBos.forEach(s->{
socialMediaBuilder.append(SocialMediaTypeEnum.getNameByType(s.getSocialMediaType()));
socialMediaBuilder.append("("+s.getSocialMediaAccount()+"):");
socialMediaBuilder.append(s.getSocialMediaFans());
if (s.getType() == null) {
return;
}
socialMediaBuilder.append(SocialMediaTypeEnum.getNameByType(s.getType()));
socialMediaBuilder.append("("+s.getAccount()+"):");
socialMediaBuilder.append(s.getFans());
socialMediaBuilder.append("<br>");
});
bo.setSocialMedia(socialMediaBuilder.toString());
... ... @@ -537,7 +540,7 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport
@Override
public List<UnionShareBankBo> getBankList(){
logger.info("getBankList");
return BankEnum.getAllBank();
return BankEnum.getAllBankAsc();
}
/**
... ... @@ -616,7 +619,7 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport
}
@Override
public int checkAndBuildBankCard(UnionShareUserBankBo bo) {
public UnionShareUserBankBo checkAndBuildBankCard(UnionShareUserBankBo bo) {
// 校验姓名
if (!ChineseNameUtils.checkName(bo.getName())) {
throw new ServiceException(ServiceError.UNION_CHINESE_NAME_ERROR);
... ... @@ -639,7 +642,7 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport
if (null == bo.getBankName()) {
throw new ServiceException(ServiceError.UNION_BANK_CODE_ERROR);
}
return 200;
return bo;
}
private boolean checkIdCard(String idcard) {
... ...