Commit c86703c4 by 杨林龙

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

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