Authored by mingdan.ge

cps三期

@@ -13,24 +13,24 @@ import java.util.Map; @@ -13,24 +13,24 @@ import java.util.Map;
13 public enum BankEnum { 13 public enum BankEnum {
14 14
15 //邮政储蓄,工商银行 15 //邮政储蓄,工商银行
16 - gs("gs","中国工商银行"),  
17 - ny("ny","中国农业银行"),  
18 - zh("zh","中国银行"),  
19 - js("js","中国建设银行"),  
20 - jt("jt","交通银行"),  
21 - yzcx("yzcx","中国邮政储蓄银行"),  
22 - zs("zs","招商银行"),  
23 - pdfz("pdfz","上海浦东发展银行"),  
24 - zx("zx","中信银行"),  
25 - gd("gd","中国光大银行"),  
26 - hx("hx","华夏银行"),  
27 - ms("ms","中国民生银行"),  
28 - gf("gf","广发银行"),  
29 - xy("xy","兴业银行"),  
30 - pa("pa","平安银行"),  
31 - hf("hf","恒丰银行"),  
32 - zhes("zhes","浙商银行"),  
33 - bh("bh","渤海银行"); 16 + zggsyh("zggsyh","中国工商银行"),
  17 + zgnyyh("zgnyyh","中国农业银行"),
  18 + zgyh("zgyh","中国银行"),
  19 + zgjsyh("zgjsyh","中国建设银行"),
  20 + jtyh("jtyh","交通银行"),
  21 + zgyzcxyh("zgyzcxyh","中国邮政储蓄银行"),
  22 + zsyh("zsyh","招商银行"),
  23 + shpdfzyh("shpdfzyh","上海浦东发展银行"),
  24 + zxyh("zxyh","中信银行"),
  25 + zggdyh("zggdyh","中国光大银行"),
  26 + hxyh("hxyh","华夏银行"),
  27 + zgmsyh("zgmsyh","中国民生银行"),
  28 + gfyh("gfyh","广发银行"),
  29 + xyyh("xyyh","兴业银行"),
  30 + payh("payh","平安银行"),
  31 + hfyh("hfyh","恒丰银行"),
  32 + zsyh2("zsyh2","浙商银行"),
  33 + bhyh("bhyh","渤海银行");
34 34
35 private String code; 35 private String code;
36 private String bankName; 36 private String bankName;
@@ -68,6 +68,28 @@ public enum BankEnum { @@ -68,6 +68,28 @@ public enum BankEnum {
68 return bankList; 68 return bankList;
69 } 69 }
70 70
  71 + public static List<UnionShareBankBo> getAllBankAsc(){
  72 + List<UnionShareBankBo> bankList = new ArrayList<>();
  73 + ascBankCode(bankList,getAllBankMap());
  74 + return bankList;
  75 + }
  76 +
  77 + private static void ascBankCode(List<UnionShareBankBo> bankList,Map<String, String> bankMap) {
  78 + if (bankMap.isEmpty()) {
  79 + return;
  80 + }
  81 + UnionShareBankBo bo = new UnionShareBankBo();
  82 + bankMap.forEach((k,v)->{
  83 + if (bo.getBankCode() == null||k.compareToIgnoreCase(bo.getBankCode())<0) {
  84 + bo.setBankCode(k);
  85 + }
  86 + });
  87 + bo.setBankName(bankMap.get(bo.getBankCode()));
  88 + bankMap.remove(bo.getBankCode());
  89 + bankList.add(bo);
  90 + ascBankCode(bankList,bankMap);
  91 + }
  92 +
71 public String getCode() { 93 public String getCode() {
72 return code; 94 return code;
73 } 95 }
@@ -12,9 +12,11 @@ import java.util.Map; @@ -12,9 +12,11 @@ import java.util.Map;
12 public enum SocialMediaTypeEnum { 12 public enum SocialMediaTypeEnum {
13 13
14 //社交媒体:1-微信公众号,2-抖音 14 //社交媒体:1-微信公众号,2-抖音
15 - wechat(1,"微信公众号"),  
16 - douyin(2,"抖音"),  
17 - weibo(3,"微博"); 15 + wechat(1,"微信"),
  16 + wechat2(2,"微信订阅号"),
  17 + douyin(3,"抖音"),
  18 + weibo(4,"微博"),
  19 + instagram(5,"instagram");
18 20
19 private int type; 21 private int type;
20 private String name; 22 private String name;
@@ -42,13 +44,16 @@ public enum SocialMediaTypeEnum { @@ -42,13 +44,16 @@ public enum SocialMediaTypeEnum {
42 return jsonArray; 44 return jsonArray;
43 } 45 }
44 46
45 - public static String getNameByType(int type) { 47 + public static String getNameByType(Integer type) {
  48 + if (type == null) {
  49 + return "";
  50 + }
46 for (SocialMediaTypeEnum e : values()) { 51 for (SocialMediaTypeEnum e : values()) {
47 if (e.getType() == type) { 52 if (e.getType() == type) {
48 return e.getName(); 53 return e.getName();
49 } 54 }
50 } 55 }
51 - return null; 56 + return type+"";
52 } 57 }
53 58
54 public int getType() { 59 public int getType() {
@@ -2,6 +2,8 @@ package com.yoho.unions.server.restapi; @@ -2,6 +2,8 @@ package com.yoho.unions.server.restapi;
2 2
3 import com.alibaba.fastjson.JSONArray; 3 import com.alibaba.fastjson.JSONArray;
4 import com.yoho.core.common.utils.JsonUtil; 4 import com.yoho.core.common.utils.JsonUtil;
  5 +import com.yoho.error.ServiceError;
  6 +import com.yoho.error.exception.ServiceException;
5 import com.yoho.service.model.union.bo.*; 7 import com.yoho.service.model.union.bo.*;
6 import com.yoho.service.model.union.request.*; 8 import com.yoho.service.model.union.request.*;
7 import com.yoho.service.model.union.response.*; 9 import com.yoho.service.model.union.response.*;
@@ -123,7 +125,10 @@ public class UnionShareRest { @@ -123,7 +125,10 @@ public class UnionShareRest {
123 public UnionResponse bindBankCard(@RequestBody UnionShareUserBankBo bo){ 125 public UnionResponse bindBankCard(@RequestBody UnionShareUserBankBo bo){
124 log.info("UnionShareRest.bindBankCard req is {}", bo); 126 log.info("UnionShareRest.bindBankCard req is {}", bo);
125 int result = unionShareService.bindBankCard(bo); 127 int result = unionShareService.bindBankCard(bo);
126 - return new UnionResponse(200, "bindBankCard success",result>0?"Y":"N"); 128 + if (result > 0) {
  129 + return new UnionResponse(200, "bindBankCard success",bo);
  130 + }
  131 + throw new ServiceException(ServiceError.UNION_BINK_BANK_CARD_ERROR);
127 } 132 }
128 133
129 /** 134 /**
@@ -135,8 +140,8 @@ public class UnionShareRest { @@ -135,8 +140,8 @@ public class UnionShareRest {
135 @ResponseBody 140 @ResponseBody
136 public UnionResponse checkBankCard(@RequestBody UnionShareUserBankBo bo){ 141 public UnionResponse checkBankCard(@RequestBody UnionShareUserBankBo bo){
137 log.info("UnionShareRest.checkBankCard req is {}", bo); 142 log.info("UnionShareRest.checkBankCard req is {}", bo);
138 - int result = unionShareService.checkAndBuildBankCard(bo);  
139 - return new UnionResponse(200, "checkBankCard success",result>0?"Y":"N"); 143 + UnionShareUserBankBo result = unionShareService.checkAndBuildBankCard(bo);
  144 + return new UnionResponse(200, "checkBankCard success",result);
140 } 145 }
141 /** 146 /**
142 * 查询绑定的银行卡 147 * 查询绑定的银行卡
@@ -93,7 +93,7 @@ public interface IUnionShareService { @@ -93,7 +93,7 @@ public interface IUnionShareService {
93 * @param bo 93 * @param bo
94 * @return 94 * @return
95 */ 95 */
96 - int checkAndBuildBankCard(UnionShareUserBankBo bo); 96 + UnionShareUserBankBo checkAndBuildBankCard(UnionShareUserBankBo bo);
97 97
98 /** 98 /**
99 * 用户前台获取个人推广近期订单(10个) 99 * 用户前台获取个人推广近期订单(10个)
@@ -48,9 +48,12 @@ public class UnionShareApplyExportImpl implements IBusinessExportService { @@ -48,9 +48,12 @@ public class UnionShareApplyExportImpl implements IBusinessExportService {
48 List<SocialMediaBo> socialMediaBos = JsonUtil.jsonToList(bo.getSocialMedia(), SocialMediaBo.class); 48 List<SocialMediaBo> socialMediaBos = JsonUtil.jsonToList(bo.getSocialMedia(), SocialMediaBo.class);
49 StringBuilder socialMediaBuilder = new StringBuilder(); 49 StringBuilder socialMediaBuilder = new StringBuilder();
50 socialMediaBos.forEach(s->{ 50 socialMediaBos.forEach(s->{
51 - socialMediaBuilder.append(SocialMediaTypeEnum.getNameByType(s.getSocialMediaType()));  
52 - socialMediaBuilder.append("("+s.getSocialMediaAccount()+"):");  
53 - socialMediaBuilder.append(s.getSocialMediaFans()); 51 + if (s.getType() == null) {
  52 + return;
  53 + }
  54 + socialMediaBuilder.append(SocialMediaTypeEnum.getNameByType(s.getType()));
  55 + socialMediaBuilder.append("("+s.getAccount()+"):");
  56 + socialMediaBuilder.append(s.getFans());
54 socialMediaBuilder.append("\n\r"); 57 socialMediaBuilder.append("\n\r");
55 }); 58 });
56 bo.setSocialMedia(socialMediaBuilder.toString()); 59 bo.setSocialMedia(socialMediaBuilder.toString());
@@ -302,9 +302,12 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport @@ -302,9 +302,12 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport
302 List<SocialMediaBo> socialMediaBos = JsonUtil.jsonToList(bo.getSocialMedia(), SocialMediaBo.class); 302 List<SocialMediaBo> socialMediaBos = JsonUtil.jsonToList(bo.getSocialMedia(), SocialMediaBo.class);
303 StringBuilder socialMediaBuilder = new StringBuilder(); 303 StringBuilder socialMediaBuilder = new StringBuilder();
304 socialMediaBos.forEach(s->{ 304 socialMediaBos.forEach(s->{
305 - socialMediaBuilder.append(SocialMediaTypeEnum.getNameByType(s.getSocialMediaType()));  
306 - socialMediaBuilder.append("("+s.getSocialMediaAccount()+"):");  
307 - socialMediaBuilder.append(s.getSocialMediaFans()); 305 + if (s.getType() == null) {
  306 + return;
  307 + }
  308 + socialMediaBuilder.append(SocialMediaTypeEnum.getNameByType(s.getType()));
  309 + socialMediaBuilder.append("("+s.getAccount()+"):");
  310 + socialMediaBuilder.append(s.getFans());
308 socialMediaBuilder.append("<br>"); 311 socialMediaBuilder.append("<br>");
309 }); 312 });
310 bo.setSocialMedia(socialMediaBuilder.toString()); 313 bo.setSocialMedia(socialMediaBuilder.toString());
@@ -537,7 +540,7 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport @@ -537,7 +540,7 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport
537 @Override 540 @Override
538 public List<UnionShareBankBo> getBankList(){ 541 public List<UnionShareBankBo> getBankList(){
539 logger.info("getBankList"); 542 logger.info("getBankList");
540 - return BankEnum.getAllBank(); 543 + return BankEnum.getAllBankAsc();
541 } 544 }
542 545
543 /** 546 /**
@@ -616,7 +619,7 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport @@ -616,7 +619,7 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport
616 } 619 }
617 620
618 @Override 621 @Override
619 - public int checkAndBuildBankCard(UnionShareUserBankBo bo) { 622 + public UnionShareUserBankBo checkAndBuildBankCard(UnionShareUserBankBo bo) {
620 // 校验姓名 623 // 校验姓名
621 if (!ChineseNameUtils.checkName(bo.getName())) { 624 if (!ChineseNameUtils.checkName(bo.getName())) {
622 throw new ServiceException(ServiceError.UNION_CHINESE_NAME_ERROR); 625 throw new ServiceException(ServiceError.UNION_CHINESE_NAME_ERROR);
@@ -639,7 +642,7 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport @@ -639,7 +642,7 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport
639 if (null == bo.getBankName()) { 642 if (null == bo.getBankName()) {
640 throw new ServiceException(ServiceError.UNION_BANK_CODE_ERROR); 643 throw new ServiceException(ServiceError.UNION_BANK_CODE_ERROR);
641 } 644 }
642 - return 200; 645 + return bo;
643 } 646 }
644 647
645 private boolean checkIdCard(String idcard) { 648 private boolean checkIdCard(String idcard) {