Commit c86703c4 by 杨林龙

修改获取省市区地址服务接口 yangll

1 parent 1e87df1e
......@@ -15,13 +15,13 @@ import com.fasterxml.jackson.annotation.JsonFormat;
public class Area implements Serializable {
private List<Area> children;
private Long id;
private Integer id;
private String areaName;
private String areaCode;
private Long parentId;
private Integer parentId;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date initDate;
......@@ -34,11 +34,11 @@ public class Area implements Serializable {
this.children = children;
}
public Long getId() {
public Integer getId() {
return id;
}
public void setId(Long id) {
public void setId(Integer id) {
this.id = id;
}
......@@ -58,11 +58,11 @@ public class Area implements Serializable {
this.areaCode = areaCode;
}
public Long getParentId() {
public Integer getParentId() {
return parentId;
}
public void setParentId(Long parentId) {
public void setParentId(Integer parentId) {
this.parentId = parentId;
}
......
......@@ -12,5 +12,9 @@ public interface AdMgrService {
int updateAd(PlatformAd ad);
int startandstop(int id, int status);
Integer startandstop(Integer id, Integer status);
// int start(int id);
//
// int stop(int id);
}
......@@ -8,5 +8,5 @@ import cn.hutool.db.Page;
public interface ApiMgrService {
R getApiMgrList(Page page);
int startAndStop(int id, int status);
Integer startAndStop(Integer id, Integer status);
}
package cn.com.glsx.openplatform.service;
import cn.com.glsx.openplatform.model.Area;
import cn.com.glsx.openplatform.model.PlatformCustomer;
import cn.com.glsx.openplatform.vo.R;
import cn.hutool.db.Page;
......@@ -20,5 +21,5 @@ public interface CustomerMgrService {
PlatformCustomer login(PlatformCustomer customer);
List<String> getAddressOptionList(int id);
List<Area> getAddressOptionList(int id);
}
......@@ -2,6 +2,7 @@ package cn.com.glsx.openplatform.mapper;
import cn.com.glsx.openplatform.model.PlatformAd;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.oreframework.datasource.mybatis.mapper.OreMapper;
import java.util.List;
......@@ -17,4 +18,6 @@ import java.util.List;
public interface PlatformAdMapper extends OreMapper<PlatformAd> {
List<PlatformAd> getAdMgrList();
int updateById(@Param("id") int id, @Param("status") int status);
}
\ No newline at end of file
package cn.com.glsx.openplatform.mapper;
import cn.com.glsx.openplatform.model.Area;
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;
import java.util.Map;
/**
* <p>Description:
......@@ -25,7 +27,7 @@ public interface PlatformCustomerMapper extends OreMapper<PlatformCustomer> {
PlatformCustomer login(PlatformCustomer customer);
List<String> getAddressOptionList(@Param("id") int id);
List<Area> getAddressOptionList(@Param("id") int id);
String getAddressStr(@Param("id") Integer id);
......
......@@ -8,6 +8,7 @@ import com.alibaba.dubbo.config.annotation.Service;
import com.github.pagehelper.PageHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.Date;
......@@ -44,10 +45,10 @@ public class AdMgrServiceImpl implements AdMgrService {
}
@Override
public int startandstop(int id, int status) {
PlatformAd ad = new PlatformAd();
ad.setId(id);
ad.setStatus(status);
return adMapper.updateByPrimaryKeySelective(ad);
@Transactional()
public Integer startandstop(Integer id, Integer status) {
int i = adMapper.updateById(id, status);
LOGGER.info("=i========" + i);
return i;
}
}
......@@ -8,6 +8,7 @@ import com.alibaba.dubbo.config.annotation.Service;
import com.github.pagehelper.PageHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.List;
......@@ -31,7 +32,11 @@ public class ApiMgrServiceImpl implements ApiMgrService {
}
@Override
public int startAndStop(int id, int status) {
return apiMapper.updateById(id,status);
@Transactional()
public Integer startAndStop(Integer id, Integer status) {
int i = apiMapper.updateById(id, status);
LOGGER.info("=i========" + i);
System.out.println("i = " + i);
return i;
}
}
package cn.com.glsx.openplatform.service;
import cn.com.glsx.openplatform.mapper.PlatformCustomerMapper;
import cn.com.glsx.openplatform.model.Area;
import cn.com.glsx.openplatform.model.PlatformCustomer;
import cn.com.glsx.openplatform.util.RSAUtils;
import cn.com.glsx.openplatform.vo.R;
......@@ -88,8 +89,9 @@ public class CustomerMgrServiceImpl implements CustomerMgrService {
}
@Override
public List<String> getAddressOptionList(int id) {
return customerMapper.getAddressOptionList(id);
public List<Area> getAddressOptionList(int id) {
List<Area> addressOptionList = customerMapper.getAddressOptionList(id);
return addressOptionList;
}
public static void main(String[] args) {
......
......@@ -24,6 +24,13 @@
update_time, create_by, update_by, remark
</sql>
<update id="updateById">
update t_platform_ad
set status = #{status,jdbcType=INTEGER},
update_time = NOW()
where id = #{id,jdbcType=INTEGER}
</update>
<select id="getAdMgrList" resultType="cn.com.glsx.openplatform.model.PlatformAd">
select
<include refid="Base_Column_List"/>
......
......@@ -34,10 +34,10 @@
left join t_platform_api c on a.api_id = c.id
where 1 = 1
<if test="accessStartTime != null">
and create_time &gt;= #{accessStartTime,jdbcType=TIMESTAMP}
and a.create_time &gt;= #{accessStartTime,jdbcType=TIMESTAMP}
</if>
<if test="accessEndTime != null">
and create_time &lt;= #{accessEndTime,jdbcType=TIMESTAMP}
and a.create_time &lt;= #{accessEndTime,jdbcType=TIMESTAMP}
</if>
</select>
......
......@@ -31,7 +31,7 @@
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, customer_name, contact_person, `password`, contact_number, contact_email, province,
city, address, `status`, public_key, private_key, channel_number, create_time, update_time,
city, address, `status`, key_id, channel_number, create_time, update_time,
create_by, update_by, remark
</sql>
......@@ -163,8 +163,6 @@
c.area_name as cityName,
concat(b.area_name, c.area_name, d.area_name, a.address) as address,
a.`status`,
a.public_key,
a.private_key,
a.channel_number,
a.create_time,
a.update_time,
......@@ -194,8 +192,10 @@
and password = #{password,jdbcType=VARCHAR}
</select>
<select id="getAddressOptionList" resultType="java.lang.String">
select area_name
<select id="getAddressOptionList" resultType="cn.com.glsx.openplatform.model.Area">
select
id ,
area_name as areaName
from t_sys_area
where 1 = 1
<choose>
......
......@@ -5,7 +5,7 @@ server.servlet.application-display-name=rpc-openplatform-container
logging.config=classpath:logback.xml
logging.path=/data/java_log/jetty/rpc-openplatform-container/rpc-openplatform-container.log
#logging.level.root=INFO
logging.level.root=debug
logging.level.cn.com=debug
ore.starter.class-name=Main
# diamond config
ore.diamond.group=open-platform
......
package cn.com.glsx.openplatform.service;
import cn.com.glsx.openplatform.Main;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import javax.annotation.Resource;
@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest(classes = Main.class)
public class ApiMgrServiceImplTest {
@Resource
private AdMgrService adMgrService;
@Test
public void startAndStop() {
int i = adMgrService.startandstop(1, 1);
System.out.println("i = " + i);
}
}
package cn.com.glsx.openplatform.service;
import cn.com.glsx.openplatform.Main;
import cn.com.glsx.openplatform.model.Area;
import cn.com.glsx.openplatform.model.PlatformCustomer;
import cn.hutool.core.util.RandomUtil;
import net.dreamlu.mica.core.utils.RsaUtil;
......@@ -13,6 +14,7 @@ import javax.annotation.Resource;
import java.security.NoSuchAlgorithmException;
import java.security.PrivateKey;
import java.security.PublicKey;
import java.util.List;
@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest(classes = Main.class)
......@@ -22,7 +24,6 @@ public class CustomerMgrServiceImplTest {
private CustomerMgrService customerMgrService;
@Test
public void register() throws NoSuchAlgorithmException {
String modulus = RandomUtil.randomNumbers(512);
String exponent = RandomUtil.randomNumbers(64);
......@@ -35,4 +36,10 @@ public class CustomerMgrServiceImplTest {
customer.setPublicKey(publicKey.getAlgorithm());
customerMgrService.register(customer);
}
@Test
public void test() {
List<Area> addressOptionList = customerMgrService.getAddressOptionList(0);
System.out.println("addressOptionList = " + addressOptionList.toString());
}
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!