Commit 8c8d60b0 by 杨林龙

完成基本开发

1 parent c2faaa49
...@@ -49,18 +49,6 @@ ...@@ -49,18 +49,6 @@
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
<version>3.5.6</version>
</dependency>
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis-spring</artifactId>
<version>2.0.6</version>
</dependency>
<dependency>
<groupId>com.github.pagehelper</groupId> <groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper</artifactId> <artifactId>pagehelper</artifactId>
<version>5.2.0</version> <version>5.2.0</version>
...@@ -78,6 +66,11 @@ ...@@ -78,6 +66,11 @@
<version>2.4.2</version> <version>2.4.2</version>
</dependency> </dependency>
<dependency>
<groupId>cn.com.glsx.openplatform</groupId>
<artifactId>rpc-openplatform-api</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies> </dependencies>
......
package com.glsx; package com.glsx;
import org.mybatis.spring.annotation.MapperScan;
import org.oreframework.boot.main.AbsOreBootStarter; import org.oreframework.boot.main.AbsOreBootStarter;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan; import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.scheduling.annotation.EnableAsync; import org.springframework.scheduling.annotation.EnableAsync;
import springfox.documentation.swagger2.annotations.EnableSwagger2; import springfox.documentation.swagger2.annotations.EnableSwagger2;
...@@ -21,7 +19,7 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2; ...@@ -21,7 +19,7 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2;
@SpringBootApplication @SpringBootApplication
@ServletComponentScan @ServletComponentScan
@EnableSwagger2 @EnableSwagger2
@MapperScan("com.glsx.mapper") //@MapperScan(basePackages = {"com.glsx.mapper"})
public class Main extends AbsOreBootStarter { public class Main extends AbsOreBootStarter {
@Override @Override
......
...@@ -62,4 +62,25 @@ public class CustomerMgrController { ...@@ -62,4 +62,25 @@ public class CustomerMgrController {
} }
return R.ok("账号状态修改成功"); return R.ok("账号状态修改成功");
} }
@RequestMapping(value = "/register", method = RequestMethod.POST)
@ResponseBody
public R register(PlatformCustomer customer) {
int num = customerMgrService.register(customer);
if (num == 0) {
return R.error("注册失败");
}
return R.ok("注册成功");
}
@RequestMapping(value = "/login", method = RequestMethod.POST)
@ResponseBody
public R login(PlatformCustomer customer) {
int num = customerMgrService.login(customer);
if (num == 0) {
return R.error("登陆失败");
}
return R.ok("登陆成功");
}
} }
...@@ -76,10 +76,10 @@ public class IndexController { ...@@ -76,10 +76,10 @@ public class IndexController {
@RequestMapping(value = "/getGraphData", method = RequestMethod.GET) @RequestMapping(value = "/getGraphData", method = RequestMethod.GET)
@ResponseBody @ResponseBody
public R getGraphData() { public R getGraphData() {
Map<String, Map<String, Integer>> hashMap = new HashMap<>(); Map<String, List<Map<String, Integer>>> hashMap = new HashMap<>();
Map<String, Integer> deviceGraphData = deviceMgrService.getDeviceGraphData(); List<Map<String, Integer>> deviceGraphData = deviceMgrService.getDeviceGraphData();
Map<String, Integer> apiCallGraphData = apiCallMgrService.getApiCallGraphData(); List<Map<String, Integer>> apiCallGraphData = apiCallMgrService.getApiCallGraphData();
hashMap.put("deviceGraphData", deviceGraphData); hashMap.put("deviceGraphData", deviceGraphData);
hashMap.put("apiCallGraphData", apiCallGraphData); hashMap.put("apiCallGraphData", apiCallGraphData);
...@@ -89,23 +89,34 @@ public class IndexController { ...@@ -89,23 +89,34 @@ public class IndexController {
@RequestMapping(value = "/getPolylineData", method = RequestMethod.GET) @RequestMapping(value = "/getPolylineData", method = RequestMethod.GET)
@ResponseBody @ResponseBody
public R getPolylineData() { public R getPolylineData() {
HashMap<String, Integer> hashMap = new HashMap<>(); HashMap<String, List<Map<String, Integer>>> hashMap = new HashMap<>();
int customerCount = customerMgrService.getCustomerCount(); List<Map<String, Integer>> deviceAccessTrendList = deviceMgrService.getDeviceAccessTrendList();
List<Map<String, Integer>> apiCallTrendList = apiCallMgrService.getApiCallTrendList();
int deviceCount = deviceMgrService.getDeviceCount(); hashMap.put("deviceAccessTrendList", deviceAccessTrendList);
hashMap.put("apiCallTrendList", apiCallTrendList);
return R.ok().data(hashMap);
}
int userCount = userMgrService.getUserCount(); @RequestMapping(value = "/getStatisticDataForUserConsole", method = RequestMethod.GET)
@ResponseBody
public R getStatisticDataForUserConsole1(String customerName) {
Map<String, Integer> hashMap = new HashMap<>();
int apiCallCount = apiCallMgrService.getApiCallCount(); int deviceCountAuth = deviceMgrService.getDeviceCountAuth(customerName);
hashMap.put("customerCount", customerCount); int userCountAuth = userMgrService.getUserCountAuth(customerName);
hashMap.put("deviceCount", deviceCount);
hashMap.put("userCount", userCount); int apiCallCountAuth = appDownloadMgrService.getApiCallCountAuth(customerName);
hashMap.put("apiCallCount", apiCallCount);
hashMap.put("deviceCount", deviceCountAuth);
hashMap.put("userCount", userCountAuth);
hashMap.put("apiCallCount", apiCallCountAuth);
return R.ok().data(hashMap); return R.ok().data(hashMap);
} }
@RequestMapping(value = "/getStatisticDataForUserConsole", method = RequestMethod.GET) @RequestMapping(value = "/getStatisticDataForUserConsole", method = RequestMethod.GET)
@ResponseBody @ResponseBody
public R getStatisticDataForUserConsole(String customerName) { public R getStatisticDataForUserConsole(String customerName) {
......
...@@ -41,5 +41,7 @@ public interface PlatformApiCallMapper { ...@@ -41,5 +41,7 @@ public interface PlatformApiCallMapper {
int getApiCallCount(); int getApiCallCount();
Map<String, Integer> getApiCallGraphData(); List<Map<String, Integer>> getApiCallGraphData();
List<Map<String, Integer>> getApiCallTrendList();
} }
\ No newline at end of file \ No newline at end of file
...@@ -2,6 +2,7 @@ package com.glsx.mapper; ...@@ -2,6 +2,7 @@ package com.glsx.mapper;
import com.glsx.model.PlatformAppDownload; import com.glsx.model.PlatformAppDownload;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
...@@ -34,5 +35,5 @@ public interface PlatformAppDownloadMapper { ...@@ -34,5 +35,5 @@ public interface PlatformAppDownloadMapper {
int updateBatchSelective(List<PlatformAppDownload> list); int updateBatchSelective(List<PlatformAppDownload> list);
int getApiCallCountAuth(String customerName); int getApiCallCountAuth(@Param("customerName") String customerName);
} }
\ No newline at end of file \ No newline at end of file
...@@ -39,4 +39,6 @@ public interface PlatformCustomerMapper { ...@@ -39,4 +39,6 @@ public interface PlatformCustomerMapper {
List<String> getCustomerNameList(); List<String> getCustomerNameList();
int getCustomerCount(); int getCustomerCount();
int login(PlatformCustomer customer);
} }
\ No newline at end of file \ No newline at end of file
...@@ -43,7 +43,9 @@ public interface PlatformDeviceMapper { ...@@ -43,7 +43,9 @@ public interface PlatformDeviceMapper {
int getDeviceCount(); int getDeviceCount();
Map<String, Integer> getDeviceGraphData(); List<Map<String, Integer>> getDeviceGraphData();
int getDeviceCountAuth(@Param("customerName") String customerName); int getDeviceCountAuth(@Param("customerName") String customerName);
List<Map<String, Integer>> getDeviceAccessTrendList();
} }
\ No newline at end of file \ No newline at end of file
...@@ -56,6 +56,11 @@ public class PlatformCustomer implements Serializable { ...@@ -56,6 +56,11 @@ public class PlatformCustomer implements Serializable {
private Integer city; private Integer city;
/** /**
* 城市 sys_area的id
*/
private Integer Area;
/**
* 详细地址 * 详细地址
*/ */
private String address; private String address;
...@@ -249,31 +254,36 @@ public class PlatformCustomer implements Serializable { ...@@ -249,31 +254,36 @@ public class PlatformCustomer implements Serializable {
this.remark = remark; this.remark = remark;
} }
public Integer getArea() {
return Area;
}
public void setArea(Integer area) {
Area = area;
}
@Override @Override
public String toString() { public String toString() {
StringBuilder sb = new StringBuilder(); return "PlatformCustomer{" +
sb.append(getClass().getSimpleName()); "id=" + id +
sb.append(" ["); ", customerName='" + customerName + '\'' +
sb.append("Hash = ").append(hashCode()); ", contactPerson='" + contactPerson + '\'' +
sb.append(", id=").append(id); ", password='" + password + '\'' +
sb.append(", customerName=").append(customerName); ", contactNumber='" + contactNumber + '\'' +
sb.append(", contactPerson=").append(contactPerson); ", contactEmail='" + contactEmail + '\'' +
sb.append(", password=").append(password); ", province=" + province +
sb.append(", contactNumber=").append(contactNumber); ", city=" + city +
sb.append(", contactEmail=").append(contactEmail); ", Area=" + Area +
sb.append(", province=").append(province); ", address='" + address + '\'' +
sb.append(", city=").append(city); ", status=" + status +
sb.append(", address=").append(address); ", publicKey='" + publicKey + '\'' +
sb.append(", status=").append(status); ", privateKey='" + privateKey + '\'' +
sb.append(", publicKey=").append(publicKey); ", channelNumber='" + channelNumber + '\'' +
sb.append(", privateKey=").append(privateKey); ", createTime=" + createTime +
sb.append(", channelNumber=").append(channelNumber); ", updateTime=" + updateTime +
sb.append(", createTime=").append(createTime); ", createBy=" + createBy +
sb.append(", updateTime=").append(updateTime); ", updateBy=" + updateBy +
sb.append(", createBy=").append(createBy); ", remark='" + remark + '\'' +
sb.append(", updateBy=").append(updateBy); '}';
sb.append(", remark=").append(remark);
sb.append("]");
return sb.toString();
} }
} }
\ No newline at end of file \ No newline at end of file
...@@ -11,5 +11,7 @@ public interface ApiCallMgrService { ...@@ -11,5 +11,7 @@ public interface ApiCallMgrService {
int getApiCallCount(); int getApiCallCount();
Map<String, Integer> getApiCallGraphData(); List<Map<String, Integer>> getApiCallGraphData();
List<Map<String, Integer>> getApiCallTrendList();
} }
...@@ -12,4 +12,8 @@ public interface CustomerMgrService { ...@@ -12,4 +12,8 @@ public interface CustomerMgrService {
int startAndStop(int id, int status); int startAndStop(int id, int status);
int getCustomerCount(); int getCustomerCount();
int register(PlatformCustomer customer);
int login(PlatformCustomer customer);
} }
...@@ -15,7 +15,9 @@ public interface DeviceMgrService { ...@@ -15,7 +15,9 @@ public interface DeviceMgrService {
int getDeviceCount(); int getDeviceCount();
Map<String, Integer> getDeviceGraphData(); List<Map<String, Integer>> getDeviceGraphData();
int getDeviceCountAuth(String customerName); int getDeviceCountAuth(String customerName);
List<Map<String, Integer>> getDeviceAccessTrendList();
} }
...@@ -8,6 +8,7 @@ import org.slf4j.LoggerFactory; ...@@ -8,6 +8,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.Date;
import java.util.List; import java.util.List;
@Service @Service
...@@ -27,11 +28,13 @@ public class AdMgrServiceImpl implements AdMgrService { ...@@ -27,11 +28,13 @@ public class AdMgrServiceImpl implements AdMgrService {
@Override @Override
public int insertAd(PlatformAd ad) { public int insertAd(PlatformAd ad) {
ad.setCreateTime(new Date());
return adMapper.insert(ad); return adMapper.insert(ad);
} }
@Override @Override
public int updateAd(PlatformAd ad) { public int updateAd(PlatformAd ad) {
ad.setUpdateTime(new Date());
return adMapper.updateByPrimaryKeySelective(ad); return adMapper.updateByPrimaryKeySelective(ad);
} }
......
...@@ -33,7 +33,12 @@ public class ApiCallMgrServiceImpl implements ApiCallMgrService { ...@@ -33,7 +33,12 @@ public class ApiCallMgrServiceImpl implements ApiCallMgrService {
} }
@Override @Override
public Map<String, Integer> getApiCallGraphData() { public List<Map<String, Integer>> getApiCallGraphData() {
return apiCallMapper.getApiCallGraphData(); return apiCallMapper.getApiCallGraphData();
} }
@Override
public List<Map<String, Integer>> getApiCallTrendList() {
return apiCallMapper.getApiCallTrendList();
}
} }
...@@ -45,4 +45,14 @@ public class CustomerMgrServiceImpl implements CustomerMgrService { ...@@ -45,4 +45,14 @@ public class CustomerMgrServiceImpl implements CustomerMgrService {
public int getCustomerCount() { public int getCustomerCount() {
return customerMapper.getCustomerCount(); return customerMapper.getCustomerCount();
} }
@Override
public int register(PlatformCustomer customer) {
return customerMapper.insertSelective(customer);
}
@Override
public int login(PlatformCustomer customer) {
return customerMapper.login(customer);
}
} }
...@@ -47,7 +47,7 @@ public class DeviceMgrServiceImpl implements DeviceMgrService { ...@@ -47,7 +47,7 @@ public class DeviceMgrServiceImpl implements DeviceMgrService {
} }
@Override @Override
public Map<String, Integer> getDeviceGraphData() { public List<Map<String, Integer>> getDeviceGraphData() {
return deviceMapper.getDeviceGraphData(); return deviceMapper.getDeviceGraphData();
} }
...@@ -55,4 +55,9 @@ public class DeviceMgrServiceImpl implements DeviceMgrService { ...@@ -55,4 +55,9 @@ public class DeviceMgrServiceImpl implements DeviceMgrService {
public int getDeviceCountAuth(String customerName) { public int getDeviceCountAuth(String customerName) {
return deviceMapper.getDeviceCountAuth(customerName); return deviceMapper.getDeviceCountAuth(customerName);
} }
@Override
public List<Map<String, Integer>> getDeviceAccessTrendList() {
return deviceMapper.getDeviceAccessTrendList();
}
} }
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
where id = #{id,jdbcType=INTEGER} where id = #{id,jdbcType=INTEGER}
</select> </select>
<select id="getApiCallMgrList" resultMap="BaseResultMap"> <select id="getApiCallMgrList" parameterType="com.glsx.vo.ApiCallVo" resultMap="BaseResultMap">
select select
a.id, a.id,
b.customer_name, b.customer_name,
...@@ -41,11 +41,11 @@ ...@@ -41,11 +41,11 @@
left join t_platform_api c left join t_platform_api c
on a.api_id = c.id on a.api_id = c.id
where 1=1 where 1=1
<if test="apiCallVo.accessStartTime != null "> <if test="accessStartTime != null ">
and create_time &gt;= apiCallVo.accessStartTime and create_time &gt;= #{accessStartTime,jdbcType=TIMESTAMP}
</if> </if>
<if test="apiCallVo.accessEndTime != null "> <if test="accessEndTime != null ">
and create_time &lt;= apiCallVo.accessEndTime and create_time &lt;= #{accessEndTime,jdbcType=TIMESTAMP}
</if> </if>
</select> </select>
...@@ -62,6 +62,14 @@ ...@@ -62,6 +62,14 @@
group by b.api_classification group by b.api_classification
</select> </select>
<select id="getApiCallTrendList" resultType="java.util.Map">
select
date_format(create_time,'%Y-%m-%d') as create_time,
count(id)
from t_platform_api_call
group by create_time
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer"> <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
<!--@mbg.generated--> <!--@mbg.generated-->
delete from t_platform_api_call delete from t_platform_api_call
......
...@@ -54,6 +54,13 @@ ...@@ -54,6 +54,13 @@
from t_platform_customer from t_platform_customer
</select> </select>
<select id="login" parameterType="com.glsx.model.PlatformCustomer" resultType="java.lang.Integer">
select count(1)
from t_platform_customer
where contact_number = #{contactNumber,jdbcType=VARCHAR}
and password = #{password,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer"> <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
<!--@mbg.generated--> <!--@mbg.generated-->
delete from t_platform_customer delete from t_platform_customer
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
where id = #{id,jdbcType=INTEGER} where id = #{id,jdbcType=INTEGER}
</select> </select>
<select id="getDeviceMgrList" resultMap="BaseResultMap"> <select id="getDeviceMgrList" parameterType="com.glsx.vo.DeviceVo" resultMap="BaseResultMap">
select select
a.id, a.id,
a.device_sn, a.device_sn,
...@@ -47,17 +47,17 @@ ...@@ -47,17 +47,17 @@
left join t_platform_customer b left join t_platform_customer b
on a.customer_id = b.id on a.customer_id = b.id
where 1 = 1 where 1 = 1
<if test="deviceVo.customerName != null and deviceVo.customerName != '' "> <if test="customerName != null and customerName != '' ">
and b.customer_name = #{deviceVo.customerName,jdbcType=VARCHAR} and b.customer_name = #{customerName,jdbcType=VARCHAR}
</if> </if>
<if test="deviceVo.deviceType != null and deviceVo.deviceType != '' "> <if test="deviceType != null and deviceType != '' ">
and a.device_type = #{deviceVo.deviceType,jdbcType=VARCHAR} and a.device_type = #{deviceType,jdbcType=VARCHAR}
</if> </if>
<if test="deviceVo.activatStartTime != null and deviceVo.activatStartTime != '' "> <if test="activatStartTime != null and activatStartTime != '' ">
and a.create_time &gt;= apiCallVo.accessStartTime and a.create_time &gt;= #{accessStartTime,jdbcType=TIMESTAMP}
</if> </if>
<if test="deviceVo.activatEndTime != null and deviceVo.activatEndTime != '' "> <if test="activatEndTime != null and activatEndTime != '' ">
and a.create_time &lt;= apiCallVo.accessEndTime and a.create_time &lt;= #{accessEndTime,jdbcType=TIMESTAMP}
</if> </if>
</select> </select>
...@@ -88,6 +88,14 @@ ...@@ -88,6 +88,14 @@
where b.customer_name = #{customerName,jdbcType=VARCHAR} where b.customer_name = #{customerName,jdbcType=VARCHAR}
</select> </select>
<select id="getDeviceAccessTrendList" resultType="java.util.Map">
select
date_format(activat_time,'%Y-%m-%d') as activat_time,
count(id)
from t_platform_device
group by activat_time
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer"> <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
<!--@mbg.generated--> <!--@mbg.generated-->
delete from t_platform_device delete from t_platform_device
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
where id = #{id,jdbcType=INTEGER} where id = #{id,jdbcType=INTEGER}
</select> </select>
<select id="getUserMgrList" resultMap="BaseResultMap"> <select id="getUserMgrList" parameterType="com.glsx.vo.UserVo" resultMap="BaseResultMap">
select select
a.id, a.id,
a.nickname, a.nickname,
...@@ -53,14 +53,14 @@ ...@@ -53,14 +53,14 @@
left join t_platform_customer b left join t_platform_customer b
on a.customer_id = b.id on a.customer_id = b.id
where 1 = 1 where 1 = 1
<if test="userVo.customerName != null and userVo.customerName != '' "> <if test="customerName != null and customerName != '' ">
and b.customer_name = #{userVo.customerName,jdbcType=VARCHAR} and b.customer_name = #{customerName,jdbcType=VARCHAR}
</if> </if>
<if test="userVo.registerStartTime != null and userVo.registerStartTime != '' "> <if test="registerStartTime != null and registerStartTime != '' ">
and a.create_time &gt;= userVo.registerStartTime and a.create_time &gt;= #{registerStartTime,jdbcType=VARCHAR}
</if> </if>
<if test="userVo.registerEndTime != null and userVo.registerEndTime != '' "> <if test="registerEndTime != null and registerEndTime != '' ">
and a.create_time &lt;= userVo.registerEndTime and a.create_time &lt;= #{registerEndTime,jdbcType=VARCHAR}
</if> </if>
</select> </select>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!