Commit f627cdf1 by 杨林龙

完成Dubbo基本开发

1 parent 614a87af
......@@ -16,4 +16,6 @@ public interface CustomerMgrService {
int register(PlatformCustomer customer);
int login(PlatformCustomer customer);
List<String> getAddressOptionList(int id);
}
......@@ -2,6 +2,7 @@ package cn.com.glsx.openplatform.mapper;
import cn.com.glsx.openplatform.model.PlatformCustomer;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.oreframework.datasource.mybatis.mapper.OreMapper;
import java.util.List;
......@@ -23,4 +24,6 @@ public interface PlatformCustomerMapper extends OreMapper<PlatformCustomer> {
int getCustomerCount();
int login(PlatformCustomer customer);
List<String> getAddressOptionList(@Param("id") int id);
}
\ No newline at end of file
......@@ -2,12 +2,18 @@ package cn.com.glsx.openplatform.service;
import cn.com.glsx.openplatform.mapper.PlatformCustomerMapper;
import cn.com.glsx.openplatform.model.PlatformCustomer;
import net.dreamlu.mica.core.utils.RsaUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.alibaba.dubbo.config.annotation.Service;
import javax.annotation.Resource;
import java.security.PrivateKey;
import java.security.PublicKey;
import java.security.SecureRandom;
import java.util.List;
import java.util.Random;
import java.util.UUID;
@Service
public class CustomerMgrServiceImpl implements CustomerMgrService {
......@@ -47,6 +53,13 @@ public class CustomerMgrServiceImpl implements CustomerMgrService {
@Override
public int register(PlatformCustomer customer) {
String modulus = UUID.randomUUID().toString();
String exponent = UUID.randomUUID().toString();
PrivateKey privateKey = RsaUtil.generatePrivateKey(modulus, exponent);
PublicKey publicKey = RsaUtil.generatePublicKey(modulus, exponent);
customer.setPrivateKey(privateKey.getAlgorithm());
customer.setPublicKey(publicKey.getAlgorithm());
return customerMapper.insertSelective(customer);
}
......@@ -54,4 +67,9 @@ public class CustomerMgrServiceImpl implements CustomerMgrService {
public int login(PlatformCustomer customer) {
return customerMapper.login(customer);
}
@Override
public List<String> getAddressOptionList(int id) {
return customerMapper.getAddressOptionList(id);
}
}
......@@ -54,4 +54,19 @@
and password = #{password,jdbcType=VARCHAR}
</select>
<select id="getAddressOptionList" resultType="java.lang.String">
select
area_name
from t_sys_area
where 1 = 1
<choose>
<when test="id != null and id != '' ">
and parent_id = #{id,jdbcType=INTEGER}
</when>
<otherwise>
and parent_id = 0
</otherwise>
</choose>
</select>
</mapper>
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!