Commit a0d6e3a1 by guojuxing

引入json包

parent 4657014e
......@@ -42,6 +42,27 @@
<version>1.18.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.12</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
</dependency>
<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
<version>1.7.0</version>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>3.2</version>
</dependency>
</dependencies>
<build>
......
......@@ -111,6 +111,32 @@ public class EnterpriseDTO implements Serializable{
*/
private List<EnterpriseResourceRelDTO> resourcesList;
/***超级管理员*/
private String userName;
/**
* 手机号
*/
private String phoneNumber;
/**
* 密码
*/
private String password;
/**
* 1:自动生成 2:自定义密码
*/
private Integer passwordType;
/**
* 确认密码
*/
private String confirmPassword;
/**
* 国际区号,如中国 86
*/
private String phoneAreaCode;
public Integer getEnterpriseId() {
return enterpriseId;
}
......@@ -238,4 +264,58 @@ public class EnterpriseDTO implements Serializable{
public void setResourcesList(List<EnterpriseResourceRelDTO> resourcesList) {
this.resourcesList = resourcesList;
}
public String getUserName() {
return userName;
}
public EnterpriseDTO setUserName(String userName) {
this.userName = userName;
return this;
}
public String getPhoneNumber() {
return phoneNumber;
}
public EnterpriseDTO setPhoneNumber(String phoneNumber) {
this.phoneNumber = phoneNumber;
return this;
}
public String getPassword() {
return password;
}
public EnterpriseDTO setPassword(String password) {
this.password = password;
return this;
}
public Integer getPasswordType() {
return passwordType;
}
public EnterpriseDTO setPasswordType(Integer passwordType) {
this.passwordType = passwordType;
return this;
}
public String getConfirmPassword() {
return confirmPassword;
}
public EnterpriseDTO setConfirmPassword(String confirmPassword) {
this.confirmPassword = confirmPassword;
return this;
}
public String getPhoneAreaCode() {
return phoneAreaCode;
}
public EnterpriseDTO setPhoneAreaCode(String phoneAreaCode) {
this.phoneAreaCode = phoneAreaCode;
return this;
}
}
......@@ -4,12 +4,13 @@ import java.io.Serializable;
import java.math.BigDecimal;
import java.util.*;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.gic.commons.util.CollectionUtil;
import org.apache.commons.beanutils.PropertyUtils;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
/**
* @ClassName: MarketServiceDTO

* @Description: 
 基础服务订购
......@@ -120,7 +121,7 @@ public class MarketServiceDTO implements Serializable{
}
public List<Map<String, Object>> getSkuMapList() {
Map<String, List<SkuDTO>> skuMap = CollectionUtil.group(skuList, "versionCode") ;
Map<String, List<SkuDTO>> skuMap = group(skuList, "versionCode") ;
List<Map<String, Object>> result = new ArrayList<>(skuMap.size());
for(Map.Entry<String, List<SkuDTO>> entry : skuMap.entrySet()) {
Map<String, Object> tempResult = new HashMap<>(16);
......@@ -211,4 +212,32 @@ public class MarketServiceDTO implements Serializable{
JSONObject json = (JSONObject) JSON.parse(discountDetail);
return (String) json.get("200");
}
public static <K, V> Map<K, List<V>> group(List<V> list, String field) {
Map<K, List<V>> map = new HashMap();
if (list != null && !list.isEmpty()) {
Object v;
Object sublist;
for(Iterator var3 = list.iterator(); var3.hasNext(); ((List)sublist).add(v)) {
v = var3.next();
Object p = null;
try {
p = PropertyUtils.getProperty(v, field);
} catch (Exception var7) {
throw new RuntimeException(var7.getMessage(), var7);
}
sublist = (List)map.get(p);
if (sublist == null) {
sublist = new ArrayList();
map.put(p, sublist);
}
}
return map;
} else {
return map;
}
}
}
package com.gic.enterprise.service;
import java.util.List;
import java.util.Map;
import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.auth.dto.UserDTO;
import com.gic.enterprise.dto.EnterpriseDTO;
import com.gic.enterprise.dto.EnterpriseLicenseDTO;
import com.gic.enterprise.dto.EnterpriseListDTO;
import com.gic.enterprise.dto.EnterpriseResourceRelDTO;
import com.gic.enterprise.dto.market.MarketServiceDTO;
import com.gic.enterprise.dto.market.OrderBuyLicenseDTO;
import com.gic.enterprise.dto.market.OrderGicDTO;
import com.gic.enterprise.qo.BuyForGicQO;
import com.gic.enterprise.qo.EnterpriseQO;
import com.gic.enterprise.qo.OrderServiceQO;
import java.util.List;
import java.util.Map;
/**
* 商户相关操作
* @ClassName: EnterpriseApiService

......@@ -32,10 +30,10 @@ public interface EnterpriseApiService {
* @Description:

 * @author guojuxing
* @param enterpriseDTO
* @param userDTO

* @param
* @return com.gic.api.base.commons.ServiceResponse<java.lang.Integer>


 */
ServiceResponse<Integer> saveEnterprise(EnterpriseDTO enterpriseDTO, UserDTO userDTO);
ServiceResponse<Integer> saveEnterprise(EnterpriseDTO enterpriseDTO);
/**
......
......@@ -86,7 +86,7 @@ public class EnterpriseApiServiceImpl implements EnterpriseApiService {
@Override
@Transactional(rollbackFor = Exception.class)
public ServiceResponse<Integer> saveEnterprise(EnterpriseDTO enterpriseDTO, UserDTO userDTO) {
public ServiceResponse<Integer> saveEnterprise(EnterpriseDTO enterpriseDTO) {
//valid param
ServiceResponse paramResult = ValidUtil.allCheckValidate(enterpriseDTO,
EnterpriseDTO.SaveEnterpriseValid.class);
......@@ -142,6 +142,7 @@ public class EnterpriseApiServiceImpl implements EnterpriseApiService {
//初始化计费中心账户
billingAccountService.createBillingAccount(enterpriseId);
UserDTO userDTO = EntityUtil.changeEntityNew(UserDTO.class, enterpriseDTO);
//新增超级管理员
userDTO.setEnterpriseId(enterpriseId);
//超级管理员
......
......@@ -122,7 +122,13 @@ public class EnterpriseController {
//密码加密
userDTO.setPassword(UserPasswordUtil.getEncryptPassword(password));
//新增商户
ServiceResponse<Integer> result = enterpriseApiService.saveEnterprise(enterpriseDTO, userDTO);
enterpriseDTO.setUserName(userDTO.getUserName())
.setPassword(userDTO.getPassword())
.setConfirmPassword(userDTO.getConfirmPassword())
.setPasswordType(userDTO.getPasswordType())
.setPhoneAreaCode(userDTO.getPhoneAreaCode())
.setPhoneNumber(userDTO.getPhoneNumber());
ServiceResponse<Integer> result = enterpriseApiService.saveEnterprise(enterpriseDTO);
if (result.isSuccess() && UserConstants.CREATE_AUTO == userDTO.getPasswordType().intValue()) {
//发送短信,通知自动生成密码
if (StringUtils.isBlank(userDTO.getPhoneAreaCode())) {
......
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