大屏接口修改

master
anthonywj 1 year ago
parent c71d67f9c6
commit e1c8b415ec

@ -1,22 +1,44 @@
package com.glxp.api.controller.stat;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageInfo;
import com.glxp.api.common.enums.ResultEnum;
import com.glxp.api.common.res.BaseResponse;
import com.glxp.api.common.util.ResultVOUtils;
import com.glxp.api.controller.BaseController;
import com.glxp.api.entity.stat.*;
import com.glxp.api.entity.sup.UserCompanyEntity;
import com.glxp.api.req.auth.FilterUserComapanyRequest;
import com.glxp.api.req.auth.UserRegisterFilterRequest;
import com.glxp.api.req.replicate.FilterReplicateRequest;
import com.glxp.api.req.stat.StatCityCorpRequest;
import com.glxp.api.req.stat.StatCorpInvRequest;
import com.glxp.api.req.trace.TraceTaskDetailRequest;
import com.glxp.api.res.PageSimpleResponse;
import com.glxp.api.res.auth.registComPerResponse;
import com.glxp.api.res.sup.UserCompanyOnlineResponse;
import com.glxp.api.res.sup.UserCompanyResponse;
import com.glxp.api.res.trace.TraceTaskDlResponse;
import com.glxp.api.service.stat.*;
import com.glxp.api.service.sup.UserCompanyOnlineService;
import com.glxp.api.service.sup.UserCompanyService;
import com.glxp.api.service.trace.TraceTaskService;
import com.glxp.api.util.DateUtil;
import com.glxp.api.util.page.ListPageRequest;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
/**
@ -109,7 +131,53 @@ public class BigVisController extends BaseController {
StatCorpCountEntity statCorpCountEntity = statCorpCountService.getOne(new QueryWrapper<StatCorpCountEntity>().last("limit 1"));
return ResultVOUtils.success(statCorpCountEntity);
}
}
@Resource
UserCompanyService userCompanyService;
@Resource
UserCompanyOnlineService userCompanyOnlineService;
/**
* 线
*/
@GetMapping("/cpt/bigVis/corp/offline")
public BaseResponse corpOffline(FilterUserComapanyRequest filterUserComapanyRequest) {
List<UserCompanyEntity> userCompanyEntities = userCompanyService.filterCompanyName(filterUserComapanyRequest);
List<UserCompanyResponse> userCompanyResponses = new ArrayList<>();
if (CollUtil.isNotEmpty(userCompanyEntities)) {
for (UserCompanyEntity userCompanyEntity : userCompanyEntities) {
UserCompanyResponse userCompanyResponse = new UserCompanyResponse();
BeanUtil.copyProperties(userCompanyEntity, userCompanyResponse);
userCompanyResponse.setRemark(null);
UserCompanyOnlineResponse userCompanyOnlineResponse = userCompanyOnlineService.findOnLineByConfig(userCompanyEntity.getId());
if (userCompanyOnlineResponse == null) {
userCompanyResponse.setOnLineStatus(3);
} else {
if (userCompanyOnlineResponse.getUpdateTime() == null) {
userCompanyResponse.setOnLineStatus(3);
} else if (DateUtil.isExpire(userCompanyOnlineResponse.getUpdateTime(), userCompanyOnlineResponse.getHeartRate())) {
Long time = System.currentTimeMillis() - userCompanyOnlineResponse.getUpdateTime().getTime();
time = time / (60 * 60 * 1000);
userCompanyResponse.setOnLineStatus(2);
userCompanyResponse.setOfflineTime(time);
} else {
userCompanyResponse.setOnLineStatus(1);
}
userCompanyResponse.setUpdateTime(userCompanyOnlineResponse.getUpdateTime());
userCompanyResponse.setHeartRate(userCompanyOnlineResponse.getHeartRate());
userCompanyResponse.setLastIp(userCompanyOnlineResponse.getLastIp());
userCompanyResponse.setRemark(userCompanyOnlineResponse.getRemark());
userCompanyResponse.setUserId(userCompanyOnlineResponse.getUserId());
}
if (userCompanyResponse.getOnLineStatus() == 2)
userCompanyResponses.add(userCompanyResponse);
}
}
Collections.sort(userCompanyResponses, Comparator.comparing(UserCompanyResponse::getOfflineTime));
Collections.reverse(userCompanyResponses);
return ResultVOUtils.success(userCompanyResponses);
}
@ -159,4 +227,46 @@ public class BigVisController extends BaseController {
List<StatAmapFlowEntity> statAmapFlowEntities = amapFlowService.list();
return ResultVOUtils.success(statAmapFlowEntities);
}
@Resource
StatProductCategoryMonitorService statProductCategoryMonitorService;
@Resource
StatCorpInvService statCorpInvService;
/**
*
*/
@ApiOperation(value = "获取重点监控品种产品数量", response = registComPerResponse.class)
@GetMapping("/bigVis/import/cpfl/list")
public BaseResponse cpflList(ListPageRequest listPageRequest, BindingResult bindingResult) {
if (bindingResult.hasErrors()) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
}
List<StatProductCategoryMonitorEntity> selectlist = statProductCategoryMonitorService.filterList(listPageRequest);
PageInfo<StatProductCategoryMonitorEntity> pageInfo;
pageInfo = new PageInfo<>(selectlist);
PageSimpleResponse<StatProductCategoryMonitorEntity> pageSimpleResponse = new PageSimpleResponse<>();
pageSimpleResponse.setTotal(pageInfo.getTotal());
pageSimpleResponse.setList(selectlist);
return ResultVOUtils.success(pageSimpleResponse);
}
/**
*
*/
@ApiOperation(value = "获取重点监控品种产品数量", response = registComPerResponse.class)
@GetMapping("/bigVis/import/corp/inv/list")
public BaseResponse corpInvList(StatCorpInvRequest statCorpInvRequest, BindingResult bindingResult) {
if (bindingResult.hasErrors()) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
}
List<StatCorpInvEntity> selectlist = statCorpInvService.filterList(statCorpInvRequest);
PageInfo<StatCorpInvEntity> pageInfo;
pageInfo = new PageInfo<>(selectlist);
PageSimpleResponse<StatCorpInvEntity> pageSimpleResponse = new PageSimpleResponse<>();
pageSimpleResponse.setTotal(pageInfo.getTotal());
pageSimpleResponse.setList(selectlist);
return ResultVOUtils.success(pageSimpleResponse);
}
}

@ -0,0 +1,17 @@
package com.glxp.api.dao.stat;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.glxp.api.entity.stat.StatCorpInvEntity;
import com.glxp.api.entity.stat.StatProductCategoryMonitorEntity;
import com.glxp.api.req.stat.StatCorpInvRequest;
import com.glxp.api.util.page.ListPageRequest;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface StatCorpInvMapper extends BaseMapper<StatCorpInvEntity> {
List<StatCorpInvEntity> filterList(StatCorpInvRequest statCorpInvRequest);
}

@ -0,0 +1,15 @@
package com.glxp.api.dao.stat;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.glxp.api.entity.stat.StatProductCategoryMonitorEntity;
import com.glxp.api.util.page.ListPageRequest;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface StatProductCategoryMonitorMapper extends BaseMapper<StatProductCategoryMonitorEntity> {
List<StatProductCategoryMonitorEntity> filterList(ListPageRequest listPageRequest);
}

@ -10,7 +10,7 @@ import java.util.Date;
/**
* <p>
*
*
* </p>
*
* @author
@ -36,7 +36,6 @@ public class UserCompanyEntity {
private Integer bussinessStatus;
@TableField("checkStatus")
private Integer checkStatus;
@ -47,7 +46,6 @@ public class UserCompanyEntity {
private String creditNum;
/**
*
*/
@ -67,7 +65,6 @@ public class UserCompanyEntity {
private String legalPerson;
/**
*
*
*/
@TableField("legalIdCard")
@ -95,6 +92,12 @@ public class UserCompanyEntity {
@TableField("areaCode")
private String areaCode;
@TableField("certCount")
private String certCount;
@TableField("productCount")
private String productCount;
/**
* 0 /3 /1 /2
*/

@ -0,0 +1,59 @@
package com.glxp.api.entity.stat;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@TableName(value = "stat_corp_inv")
public class StatCorpInvEntity implements Serializable {
@TableId(value = "id", type = IdType.INPUT)
private Integer id;
@TableField(value = "corpName")
private String corpName;
@TableField(value = "corpId")
private Long corpId;
@TableField(value = "tyshxydm")
private String tyshxydm;
@TableField(value = "productType")
private String productType;
@TableField(value = "productName")
private String productName;
@TableField(value = "statCount")
private Integer statCount;
/**
*
*/
@TableField(value = "invDate")
private String invDate;
@TableField(value = "updateTime")
private Date updateTime;
@TableField(value = "uploadFlag")
private Integer uploadFlag;
@TableField(value = "lastUploadTime")
private Date lastUploadTime;
@TableField(value = "bussinessName")
private String bussinessName;
private static final long serialVersionUID = 1L;
}

@ -0,0 +1,35 @@
package com.glxp.api.entity.stat;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@TableName(value = "stat_product_category_monitor")
public class StatProductCategoryMonitorEntity implements Serializable {
@TableId(value = "id", type = IdType.INPUT)
private Integer id;
@TableField(value = "flbm")
private String flbm;
@TableField(value = "flmc")
private String flmc;
@TableField(value = "`count`")
private Integer count;
@TableField(value = "remark")
private String remark;
private static final long serialVersionUID = 1L;
}

@ -111,6 +111,9 @@ public class UserCompanyEntity implements Serializable {
@TableField(exist = false)
private Integer onLineStatus;
private static final long serialVersionUID = 1L;
}

@ -24,4 +24,7 @@ public class FilterUserComapanyRequest extends ListPageRequest {
@ApiModelProperty(value = "企业类型")
private String bussinessStatus;
private String regionCode;
}

@ -0,0 +1,37 @@
package com.glxp.api.req.stat;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.glxp.api.util.page.ListPageRequest;
import lombok.Data;
import java.util.Date;
@Data
public class StatCorpInvRequest extends ListPageRequest {
private Integer id;
private String corpName;
private Long corpId;
private String tyshxydm;
private String productType;
private String productName;
private Integer statCount;
/**
*
*/
private String invDate;
private Date updateTime;
private Integer uploadFlag;
private Date lastUploadTime;
}

@ -1,5 +1,6 @@
package com.glxp.api.res.auth;
import com.baomidou.mybatisplus.annotation.TableField;
import com.glxp.api.entity.sup.UserCertEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@ -110,19 +111,11 @@ public class registComPerResponse {
@ApiModelProperty(value = "注册时间")
private String registerTime;
private String certCount;
private String productCount;
private String corpCategory;
}

@ -76,4 +76,7 @@ public class UserCompanyResponse extends UserCompanyEntity {
*/
@ApiModelProperty(value = "邮箱")
private String personEmail;
private Long offlineTime;
}

@ -0,0 +1,30 @@
package com.glxp.api.service.stat;
import com.github.pagehelper.PageHelper;
import com.glxp.api.dao.stat.StatProductCategoryMonitorMapper;
import com.glxp.api.entity.stat.StatProductCategoryMonitorEntity;
import com.glxp.api.req.stat.StatCorpInvRequest;
import com.glxp.api.util.page.ListPageRequest;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.glxp.api.dao.stat.StatCorpInvMapper;
import com.glxp.api.entity.stat.StatCorpInvEntity;
import javax.annotation.Resource;
import java.util.Collections;
import java.util.List;
@Service
public class StatCorpInvService extends ServiceImpl<StatCorpInvMapper, StatCorpInvEntity> {
@Resource
StatCorpInvMapper statCorpInvMapper;
public List<StatCorpInvEntity> filterList(StatCorpInvRequest statCorpInvRequest) {
if (statCorpInvRequest == null) {
return Collections.emptyList();
}
int offset = (statCorpInvRequest.getPage() - 1) * statCorpInvRequest.getLimit();
PageHelper.offsetPage(offset, statCorpInvRequest.getLimit());
return statCorpInvMapper.filterList(statCorpInvRequest);
}
}

@ -0,0 +1,31 @@
package com.glxp.api.service.stat;
import com.github.pagehelper.PageHelper;
import com.glxp.api.entity.purchase.CustomerContactEntity;
import com.glxp.api.req.purchase.CustomerContactFilterRequest;
import com.glxp.api.util.page.ListPageRequest;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.glxp.api.entity.stat.StatProductCategoryMonitorEntity;
import com.glxp.api.dao.stat.StatProductCategoryMonitorMapper;
import javax.annotation.Resource;
import java.util.Collections;
import java.util.List;
@Service
public class StatProductCategoryMonitorService extends ServiceImpl<StatProductCategoryMonitorMapper, StatProductCategoryMonitorEntity> {
@Resource
StatProductCategoryMonitorMapper statProductCategoryMonitorMapper;
public List<StatProductCategoryMonitorEntity> filterList(ListPageRequest listPageRequest) {
if (listPageRequest == null) {
return Collections.emptyList();
}
int offset = (listPageRequest.getPage() - 1) * listPageRequest.getLimit();
PageHelper.offsetPage(offset, listPageRequest.getLimit());
return statProductCategoryMonitorMapper.filterList(listPageRequest);
}
}

@ -4,7 +4,7 @@ server:
spring:
datasource:
driver-class-name: com.p6spy.engine.spy.P6SpyDriver
jdbc-url: jdbc:p6spy:mysql://127.0.0.1:3306/udi_cpt?allowMultiQueries=true&serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true
jdbc-url: jdbc:p6spy:mysql://127.0.0.1:3306/udi_cpt2?allowMultiQueries=true&serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true
username: root
password: 123456
hikari:

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.glxp.api.dao.stat.StatCorpInvMapper">
<resultMap id="BaseResultMap" type="com.glxp.api.entity.stat.StatCorpInvEntity">
<!--@mbg.generated-->
<!--@Table stat_corp_inv-->
<id column="id" jdbcType="INTEGER" property="id"/>
<result column="corpName" jdbcType="VARCHAR" property="corpName"/>
<result column="corpId" jdbcType="BIGINT" property="corpId"/>
<result column="tyshxydm" jdbcType="VARCHAR" property="tyshxydm"/>
<result column="productType" jdbcType="VARCHAR" property="productType"/>
<result column="productName" jdbcType="VARCHAR" property="productName"/>
<result column="statCount" jdbcType="INTEGER" property="statCount"/>
<result column="invDate" jdbcType="VARCHAR" property="invDate"/>
<result column="updateTime" jdbcType="TIMESTAMP" property="updateTime"/>
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, corpName, corpId, tyshxydm, productType, productName, statCount, invDate, updateTime
</sql>
<select id="filterList"
resultType="com.glxp.api.entity.stat.StatCorpInvEntity">
SELECT *
FROM stat_corp_inv
<where>
<if test="uploadFlag != null">
AND uploadFlag = #{uploadFlag}
</if>
</where>
</select>
</mapper>

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.glxp.api.dao.stat.StatProductCategoryMonitorMapper">
<resultMap id="BaseResultMap" type="com.glxp.api.entity.stat.StatProductCategoryMonitorEntity">
<!--@mbg.generated-->
<!--@Table stat_product_category_monitor-->
<id column="id" jdbcType="INTEGER" property="id"/>
<result column="flbm" jdbcType="VARCHAR" property="flbm"/>
<result column="flmc" jdbcType="VARCHAR" property="flmc"/>
<result column="count" jdbcType="INTEGER" property="count"/>
<result column="remark" jdbcType="VARCHAR" property="remark"/>
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, flbm, flmc, `count`, remark
</sql>
<select id="filterList"
resultType="com.glxp.api.entity.stat.StatProductCategoryMonitorEntity">
SELECT *
FROM stat_product_category_monitor
</select>
</mapper>

@ -28,74 +28,67 @@
registerTime, legalPerson, legalIdCard, registerAddress, contactWay, comments, checkStatus,
checkTime
</sql>
<select id="selectAllInfo" resultType="com.glxp.api.res.auth.registComPerResponse"
<select id="selectAllInfo" resultType="com.glxp.api.res.auth.registComPerResponse"
parameterType="com.glxp.api.req.auth.UserRegisterFilterRequest">
select user_register.*,
user_person.id as upId,
user_company.checkStatus as ucstatus,
user_company.reason,
user_company.id as ucId
from
user_register LEFT JOIN user_company on user_register.companyId=user_company.id
LEFT JOIN user_person on user_register.companyId=user_person.companyId
user_person.id as upId,
user_company.checkStatus as ucstatus,
user_company.reason,
user_company.id as ucId
from user_register
LEFT JOIN user_company on user_register.companyId = user_company.id
LEFT JOIN user_person on user_register.companyId = user_person.companyId
<where>
<if test="mobile !=null and mobile != ''">
and user_register.mobile =#{mobile}
</if>
<if test="companyId !=null and companyId != ''">
and user_register.companyId =#{companyId}
<if test="mobile != null and mobile != ''">
and user_register.mobile = #{mobile}
</if>
<if test="companyId != null and companyId != ''">
and user_register.companyId = #{companyId}
</if>
</where>
</select>
<select id="selectResList" resultType="com.glxp.api.res.auth.registComPerResponse"
parameterType="com.glxp.api.req.auth.UserRegisterFilterRequest">
select user_register.*,
user_person.id as upId,
user_person.id as upId,
user_company.checkStatus as ucstatus,
user_company.reason,
user_company.id as ucId
user_company.id as ucId,
user_company.certCount,
user_company.productCount,
user_company.corpCategory
from
user_company
from user_company
LEFT JOIN user_register ON user_register.companyId = user_company.id
LEFT JOIN user_person ON user_company.id = user_person.companyId
LEFT JOIN user_register ON user_register.companyId = user_company.id
LEFT JOIN user_person ON user_company.id = user_person.companyId
<where>
and user_register.checkStatus != 0
<if test="companyName !=null and companyName != ''">
and user_register.companyName like concat('%', #{companyName},'%')
<if test="companyName != null and companyName != ''">
and user_register.companyName like concat('%', #{companyName}, '%')
</if>
<if test="checkStatus !=null and checkStatus != ''">
and user_register.checkStatus =#{checkStatus}
<if test="checkStatus != null and checkStatus != ''">
and user_register.checkStatus = #{checkStatus}
</if>
<if test="creditNum !=null and creditNum != ''">
and user_company.creditNum =#{creditNum}
<if test="creditNum != null and creditNum != ''">
and user_company.creditNum = #{creditNum}
</if>
<if test="bussinessStatus !=null and bussinessStatus != ''">
and user_company.bussinessStatus =#{bussinessStatus}
<if test="bussinessStatus != null and bussinessStatus != ''">
and user_company.bussinessStatus = #{bussinessStatus}
</if>
</where>
</select>
<select id="selectByMobile" resultType="com.glxp.api.entity.sup.UserRegisterEntity"
parameterType="String">
select user_register.*
from
user_register
from user_register
<where>
<if test="mobile !=null and mobile != ''">
and mobile =#{mobile}
<if test="mobile != null and mobile != ''">
and mobile = #{mobile}
</if>
</where>
</select>
</mapper>

Loading…
Cancel
Save