提交 adee2ab2 编写于 作者: peijun.zhao's avatar peijun.zhao

账户增加 商户渠道新增用户

上级 62840589
流水线 #29389 已失败 于阶段
in 0 second
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
<groupId>com.pica.cloud.account</groupId> <groupId>com.pica.cloud.account</groupId>
<artifactId>pica-cloud-account-client</artifactId> <artifactId>pica-cloud-account-client</artifactId>
<version>1.0.3.7</version> <version>1.0.3.8</version>
<name>pica-cloud-account-client</name> <name>pica-cloud-account-client</name>
<packaging>jar</packaging> <packaging>jar</packaging>
......
...@@ -12,6 +12,7 @@ import org.springframework.web.bind.annotation.RequestBody; ...@@ -12,6 +12,7 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader; import org.springframework.web.bind.annotation.RequestHeader;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* Created on 2019/10/16 17:28 * Created on 2019/10/16 17:28
...@@ -31,7 +32,7 @@ public interface RegisterClient { ...@@ -31,7 +32,7 @@ public interface RegisterClient {
PicaResponse<List<Integer>> register(@RequestBody CircleAcctInitReq circleAcctInitReq, @RequestHeader(value = "token") String token); PicaResponse<List<Integer>> register(@RequestBody CircleAcctInitReq circleAcctInitReq, @RequestHeader(value = "token") String token);
@PostMapping(value = "/account/shop/acct") @PostMapping(value = "/account/shop/acct")
PicaResponse<List<Integer>> shopRegister(@RequestBody ShopAcctInitReq shopAcctInitReq, @RequestHeader(value = "token") String token); PicaResponse<Map<String,Integer>> shopRegister(@RequestBody ShopAcctInitReq shopAcctInitReq, @RequestHeader(value = "token") String token);
} }
\ No newline at end of file
...@@ -19,6 +19,6 @@ public interface CircleAccountService { ...@@ -19,6 +19,6 @@ public interface CircleAccountService {
List<Integer> createCircleAccount(CircleAcctInitReq circleAcctInitReq); List<Integer> createCircleAccount(CircleAcctInitReq circleAcctInitReq);
List<Integer> createShopAccount(ShopAcctInitReq shopAcctInitReq); Map<String,Integer> createShopAccount(ShopAcctInitReq shopAcctInitReq);
} }
...@@ -19,7 +19,9 @@ import org.springframework.stereotype.Service; ...@@ -19,7 +19,9 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
...@@ -70,10 +72,12 @@ public class CircleAccountServiceImpl implements CircleAccountService { ...@@ -70,10 +72,12 @@ public class CircleAccountServiceImpl implements CircleAccountService {
} }
@Override @Override
public List<Integer> createShopAccount(ShopAcctInitReq shopAcctInitReq) { public Map<String,Integer> createShopAccount(ShopAcctInitReq shopAcctInitReq) {
Map<String,Integer> rtnMap = new HashMap();
logger.info("createShopAccount:{}", JSONObject.toJSONString(shopAcctInitReq)); logger.info("createShopAccount:{}", JSONObject.toJSONString(shopAcctInitReq));
List<ShopAcctInit> shopAcctInits = shopAcctInitReq.getShopAcctInitList(); List<ShopAcctInit> shopAcctInits = shopAcctInitReq.getShopAcctInitList();
List<Integer> savedIds = new ArrayList<>(); // List<Integer> savedIds = new ArrayList<>();
try { try {
for(ShopAcctInit acct : shopAcctInits){ for(ShopAcctInit acct : shopAcctInits){
String encryMobile = EncryptUtils.encryptContent(acct.getMobile(), EncryptConstants.ENCRYPT_TYPE_MOBILE); String encryMobile = EncryptUtils.encryptContent(acct.getMobile(), EncryptConstants.ENCRYPT_TYPE_MOBILE);
...@@ -85,11 +89,13 @@ public class CircleAccountServiceImpl implements CircleAccountService { ...@@ -85,11 +89,13 @@ public class CircleAccountServiceImpl implements CircleAccountService {
account.setMobilePhone(encryMobile); account.setMobilePhone(encryMobile);
account.setRegisterSource(shopAcctInitReq.getRegisterSource()); account.setRegisterSource(shopAcctInitReq.getRegisterSource());
accountService.createAccount(account,AccountTypeEnum.PRODUCT_TYPE_DOCTOR.getCode()); accountService.createAccount(account,AccountTypeEnum.PRODUCT_TYPE_DOCTOR.getCode());
savedIds.add(account.getId().intValue()); // savedIds.add(account.getId().intValue());
logger.info("createShopAccount insert {}",account.getId().intValue()); logger.info("createShopAccount insert {}",account.getId().intValue());
rtnMap.put(acct.getMobile(),account.getId().intValue());
}else { }else {
savedIds.add(dbAcct.getId().intValue()); // savedIds.add(dbAcct.getId().intValue());
logger.info("createShopAccount exist {}",dbAcct.getId().intValue()); logger.info("createShopAccount exist {}",dbAcct.getId().intValue());
rtnMap.put(acct.getMobile(),dbAcct.getId().intValue());
} }
} }
}catch (Exception e){ }catch (Exception e){
...@@ -97,7 +103,7 @@ public class CircleAccountServiceImpl implements CircleAccountService { ...@@ -97,7 +103,7 @@ public class CircleAccountServiceImpl implements CircleAccountService {
throw e; throw e;
} }
return savedIds; return rtnMap;
} }
} }
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册