Commit 8c8d60b0 by 杨林龙

完成基本开发

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