Compare commits
4 Commits
bd0a615254
...
bd26ae2d34
Author | SHA1 | Date | |
---|---|---|---|
![]() |
bd26ae2d34 | ||
![]() |
a5127cd50b | ||
![]() |
d5b31fded3 | ||
![]() |
0fa0ace166 |
|
@ -1,16 +1,16 @@
|
||||||
package com.ruoyi.bst.agreement.domain;
|
package com.ruoyi.bst.agreement.domain;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
import com.ruoyi.common.annotation.Excel;
|
import com.ruoyi.common.annotation.Excel;
|
||||||
import com.ruoyi.common.core.domain.BaseEntity;
|
import com.ruoyi.common.core.domain.BaseEntity;
|
||||||
import com.ruoyi.common.core.interfaces.LogBizParam;
|
import com.ruoyi.common.core.interfaces.LogBizParam;
|
||||||
|
|
||||||
import com.ruoyi.common.core.validate.ValidGroup;
|
import com.ruoyi.common.core.validate.ValidGroup;
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import javax.validation.constraints.NotBlank;
|
|
||||||
import javax.validation.constraints.NotNull;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 协议对象 bst_agreement
|
* 协议对象 bst_agreement
|
||||||
*
|
*
|
||||||
|
@ -23,11 +23,7 @@ public class Agreement extends BaseEntity implements LogBizParam
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
@Excel(name = "商户ID")
|
|
||||||
@ApiModelProperty("商户ID")
|
|
||||||
private Long storeId;
|
|
||||||
|
|
||||||
@Excel(name = "运营区ID")
|
@Excel(name = "运营区ID")
|
||||||
@ApiModelProperty("运营区ID")
|
@ApiModelProperty("运营区ID")
|
||||||
private Long areaId;
|
private Long areaId;
|
||||||
|
|
|
@ -6,6 +6,8 @@ import lombok.Data;
|
||||||
@Data
|
@Data
|
||||||
public class AgreementVO extends Agreement{
|
public class AgreementVO extends Agreement{
|
||||||
|
|
||||||
|
@ApiModelProperty("运营商ID")
|
||||||
|
private Long storeId;
|
||||||
|
|
||||||
@ApiModelProperty("商户名")
|
@ApiModelProperty("商户名")
|
||||||
private String userName;
|
private String userName;
|
||||||
|
@ -16,7 +18,4 @@ public class AgreementVO extends Agreement{
|
||||||
@ApiModelProperty("代理商ID")
|
@ApiModelProperty("代理商ID")
|
||||||
private Long agentId;
|
private Long agentId;
|
||||||
|
|
||||||
@ApiModelProperty("运营商ID")
|
|
||||||
private Long storeId;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
package com.ruoyi.bst.agreement.domain.enums;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public enum AgreementType {
|
||||||
|
|
||||||
|
NOTICE("0", "公告"),
|
||||||
|
RENT("1", "租赁协议");
|
||||||
|
|
||||||
|
private final String code;
|
||||||
|
private final String name;
|
||||||
|
|
||||||
|
}
|
|
@ -38,16 +38,6 @@ public interface AgreementMapper
|
||||||
*/
|
*/
|
||||||
int insertAgreement(Agreement agreement);
|
int insertAgreement(Agreement agreement);
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量新增协议
|
|
||||||
*/
|
|
||||||
int batchInsert(@Param("list") List<? extends Agreement> list);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量修改协议
|
|
||||||
*/
|
|
||||||
int batchUpdate(@Param("list") List<? extends Agreement> list);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改协议
|
* 修改协议
|
||||||
*
|
*
|
||||||
|
|
|
@ -32,6 +32,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<sql id="searchCondition">
|
<sql id="searchCondition">
|
||||||
|
<if test="query.storeId != null "> and ba.user_id = #{query.storeId}</if>
|
||||||
<if test="query.areaId != null "> and bag.area_id = #{query.areaId}</if>
|
<if test="query.areaId != null "> and bag.area_id = #{query.areaId}</if>
|
||||||
<if test="query.title != null and query.title != ''"> and bag.title like concat('%', #{query.title}, '%')</if>
|
<if test="query.title != null and query.title != ''"> and bag.title like concat('%', #{query.title}, '%')</if>
|
||||||
<if test="query.brief != null and query.brief != ''"> and bag.brief like concat('%', #{query.brief}, '%')</if>
|
<if test="query.brief != null and query.brief != ''"> and bag.brief like concat('%', #{query.brief}, '%')</if>
|
||||||
|
@ -45,7 +46,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<foreach collection="query.ids" item="id" open="(" separator="," close=")">
|
<foreach collection="query.ids" item="id" open="(" separator="," close=")">
|
||||||
#{id}
|
#{id}
|
||||||
</foreach>
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
${@com.ruoyi.framework.util.DataScopeUtil@dataScope(
|
${@com.ruoyi.framework.util.DataScopeUtil@dataScope(
|
||||||
null,
|
null,
|
||||||
"ba.user_id,su.agent_id",
|
"ba.user_id,su.agent_id",
|
||||||
|
@ -65,7 +66,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
|
||||||
<select id="selectAgreementById" parameterType="Long" resultMap="AgreementResult">
|
<select id="selectAgreementById" parameterType="Long" resultMap="AgreementResult">
|
||||||
<include refid="selectAgreementVo"/>
|
<include refid="selectAgreementVo"/>
|
||||||
where bag.id = #{id}
|
where bag.id = #{id}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
@ -103,131 +104,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
</trim>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
<insert id="batchInsert" parameterType="Agreement" useGeneratedKeys="true" keyProperty="id">
|
|
||||||
insert into bst_agreement
|
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
||||||
area_id,
|
|
||||||
title,
|
|
||||||
brief,
|
|
||||||
content,
|
|
||||||
agreement_type,
|
|
||||||
duration,
|
|
||||||
create_time,
|
|
||||||
update_time,
|
|
||||||
</trim>
|
|
||||||
values
|
|
||||||
<foreach collection="list" item="i" separator=",">
|
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
||||||
<if test="i.areaId != null ">#{i.areaId},</if>
|
|
||||||
<if test="i.areaId == null ">default,</if>
|
|
||||||
<if test="i.title != null and i.title != ''">#{i.title},</if>
|
|
||||||
<if test="i.title == null or i.title == ''">default,</if>
|
|
||||||
<if test="i.brief != null ">#{i.brief},</if>
|
|
||||||
<if test="i.brief == null ">default,</if>
|
|
||||||
<if test="i.content != null ">#{i.content},</if>
|
|
||||||
<if test="i.content == null ">default,</if>
|
|
||||||
<if test="i.agreementType != null ">#{i.agreementType},</if>
|
|
||||||
<if test="i.agreementType == null ">default,</if>
|
|
||||||
<if test="i.duration != null ">#{i.duration},</if>
|
|
||||||
<if test="i.duration == null ">default,</if>
|
|
||||||
<if test="i.createTime != null ">#{i.createTime},</if>
|
|
||||||
<if test="i.createTime == null ">default,</if>
|
|
||||||
<if test="i.updateTime != null ">#{i.updateTime},</if>
|
|
||||||
<if test="i.updateTime == null ">default,</if>
|
|
||||||
</trim>
|
|
||||||
</foreach>
|
|
||||||
</insert>
|
|
||||||
|
|
||||||
<update id="batchUpdate">
|
|
||||||
update bst_agreement
|
|
||||||
<trim prefix="SET" suffixOverrides=",">
|
|
||||||
<foreach open="area_id = CASE id" collection="list" item="item" close="END,">
|
|
||||||
<choose>
|
|
||||||
<when test="item.areaId != null ">
|
|
||||||
WHEN #{item.id} THEN #{item.areaId}
|
|
||||||
</when>
|
|
||||||
<otherwise>
|
|
||||||
WHEN #{item.id} THEN `area_id`
|
|
||||||
</otherwise>
|
|
||||||
</choose>
|
|
||||||
</foreach>
|
|
||||||
<foreach open="title = CASE id" collection="list" item="item" close="END,">
|
|
||||||
<choose>
|
|
||||||
<when test="item.title != null and item.title != ''">
|
|
||||||
WHEN #{item.id} THEN #{item.title}
|
|
||||||
</when>
|
|
||||||
<otherwise>
|
|
||||||
WHEN #{item.id} THEN `title`
|
|
||||||
</otherwise>
|
|
||||||
</choose>
|
|
||||||
</foreach>
|
|
||||||
<foreach open="brief = CASE id" collection="list" item="item" close="END,">
|
|
||||||
<choose>
|
|
||||||
<when test="item.brief != null ">
|
|
||||||
WHEN #{item.id} THEN #{item.brief}
|
|
||||||
</when>
|
|
||||||
<otherwise>
|
|
||||||
WHEN #{item.id} THEN `brief`
|
|
||||||
</otherwise>
|
|
||||||
</choose>
|
|
||||||
</foreach>
|
|
||||||
<foreach open="content = CASE id" collection="list" item="item" close="END,">
|
|
||||||
<choose>
|
|
||||||
<when test="item.content != null ">
|
|
||||||
WHEN #{item.id} THEN #{item.content}
|
|
||||||
</when>
|
|
||||||
<otherwise>
|
|
||||||
WHEN #{item.id} THEN `content`
|
|
||||||
</otherwise>
|
|
||||||
</choose>
|
|
||||||
</foreach>
|
|
||||||
<foreach open="agreement_type = CASE id" collection="list" item="item" close="END,">
|
|
||||||
<choose>
|
|
||||||
<when test="item.agreementType != null ">
|
|
||||||
WHEN #{item.id} THEN #{item.agreementType}
|
|
||||||
</when>
|
|
||||||
<otherwise>
|
|
||||||
WHEN #{item.id} THEN `agreement_type`
|
|
||||||
</otherwise>
|
|
||||||
</choose>
|
|
||||||
</foreach>
|
|
||||||
<foreach open="duration = CASE id" collection="list" item="item" close="END,">
|
|
||||||
<choose>
|
|
||||||
<when test="item.duration != null ">
|
|
||||||
WHEN #{item.id} THEN #{item.duration}
|
|
||||||
</when>
|
|
||||||
<otherwise>
|
|
||||||
WHEN #{item.id} THEN `duration`
|
|
||||||
</otherwise>
|
|
||||||
</choose>
|
|
||||||
</foreach>
|
|
||||||
<foreach open="create_time = CASE id" collection="list" item="item" close="END,">
|
|
||||||
<choose>
|
|
||||||
<when test="item.createTime != null ">
|
|
||||||
WHEN #{item.id} THEN #{item.createTime}
|
|
||||||
</when>
|
|
||||||
<otherwise>
|
|
||||||
WHEN #{item.id} THEN `create_time`
|
|
||||||
</otherwise>
|
|
||||||
</choose>
|
|
||||||
</foreach>
|
|
||||||
<foreach open="update_time = CASE id" collection="list" item="item" close="END,">
|
|
||||||
<choose>
|
|
||||||
<when test="item.updateTime != null ">
|
|
||||||
WHEN #{item.id} THEN #{item.updateTime}
|
|
||||||
</when>
|
|
||||||
<otherwise>
|
|
||||||
WHEN #{item.id} THEN `update_time`
|
|
||||||
</otherwise>
|
|
||||||
</choose>
|
|
||||||
</foreach>
|
|
||||||
</trim>
|
|
||||||
where id in
|
|
||||||
<foreach item="item" collection="list" open="(" separator="," close=")">
|
|
||||||
#{item.id}
|
|
||||||
</foreach>
|
|
||||||
</update>
|
|
||||||
|
|
||||||
<update id="updateAgreement" parameterType="Agreement">
|
<update id="updateAgreement" parameterType="Agreement">
|
||||||
update bst_agreement bag
|
update bst_agreement bag
|
||||||
<trim prefix="SET" suffixOverrides=",">
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
package com.ruoyi.bst.agreement.service;
|
package com.ruoyi.bst.agreement.service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.ruoyi.bst.agreement.domain.Agreement;
|
import com.ruoyi.bst.agreement.domain.Agreement;
|
||||||
import com.ruoyi.bst.agreement.domain.AgreementVO;
|
|
||||||
import com.ruoyi.bst.agreement.domain.AgreementQuery;
|
import com.ruoyi.bst.agreement.domain.AgreementQuery;
|
||||||
|
import com.ruoyi.bst.agreement.domain.AgreementVO;
|
||||||
|
import com.ruoyi.bst.agreement.domain.enums.AgreementType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 协议Service接口
|
* 协议Service接口
|
||||||
|
@ -61,4 +63,12 @@ public interface AgreementService
|
||||||
*/
|
*/
|
||||||
public int deleteAgreementById(Long id);
|
public int deleteAgreementById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 复制模板
|
||||||
|
* @param type
|
||||||
|
* @param areaId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public int copyTemplate(AgreementType type, Long areaId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,9 @@ public class AgreementConverterImpl implements AgreementConverter {
|
||||||
po.setTitle(data.getTitle());
|
po.setTitle(data.getTitle());
|
||||||
if (SecurityUtils.isAdmin()){
|
if (SecurityUtils.isAdmin()){
|
||||||
po.setContentType(data.getContentType());
|
po.setContentType(data.getContentType());
|
||||||
}else po.setContentType(AgreementContentType.TEXT.getCode());
|
}else po.setContentType(
|
||||||
|
AgreementContentType.TEXT.getCode()
|
||||||
|
);
|
||||||
po.setAgreementType(data.getAgreementType());
|
po.setAgreementType(data.getAgreementType());
|
||||||
po.setBrief(data.getBrief());
|
po.setBrief(data.getBrief());
|
||||||
po.setContent(data.getContent());
|
po.setContent(data.getContent());
|
||||||
|
|
|
@ -2,25 +2,23 @@ package com.ruoyi.bst.agreement.service.impl;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.support.TransactionTemplate;
|
||||||
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
|
import com.github.pagehelper.PageHelper;
|
||||||
|
import com.ruoyi.bst.agreement.domain.Agreement;
|
||||||
|
import com.ruoyi.bst.agreement.domain.AgreementQuery;
|
||||||
|
import com.ruoyi.bst.agreement.domain.AgreementVO;
|
||||||
import com.ruoyi.bst.agreement.domain.enums.AgreementContentType;
|
import com.ruoyi.bst.agreement.domain.enums.AgreementContentType;
|
||||||
import com.ruoyi.bst.area.domain.AreaQuery;
|
import com.ruoyi.bst.agreement.domain.enums.AgreementType;
|
||||||
import com.ruoyi.bst.area.domain.AreaVO;
|
import com.ruoyi.bst.agreement.mapper.AgreementMapper;
|
||||||
|
import com.ruoyi.bst.agreement.service.AgreementService;
|
||||||
import com.ruoyi.bst.area.service.AreaService;
|
import com.ruoyi.bst.area.service.AreaService;
|
||||||
import com.ruoyi.bst.device.domain.DeviceVO;
|
|
||||||
import com.ruoyi.bst.model.domain.ModelVO;
|
|
||||||
import com.ruoyi.common.core.domain.vo.UserVO;
|
|
||||||
import com.ruoyi.common.utils.DateUtils;
|
import com.ruoyi.common.utils.DateUtils;
|
||||||
import com.ruoyi.common.utils.ServiceUtil;
|
import com.ruoyi.common.utils.ServiceUtil;
|
||||||
import com.ruoyi.system.user.service.UserService;
|
import com.ruoyi.system.user.service.UserService;
|
||||||
import org.springframework.beans.BeanUtils;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import com.ruoyi.bst.agreement.mapper.AgreementMapper;
|
|
||||||
import com.ruoyi.bst.agreement.domain.Agreement;
|
|
||||||
import com.ruoyi.bst.agreement.domain.AgreementVO;
|
|
||||||
import com.ruoyi.bst.agreement.domain.AgreementQuery;
|
|
||||||
import com.ruoyi.bst.agreement.service.AgreementService;
|
|
||||||
import org.springframework.transaction.support.TransactionTemplate;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 协议Service业务层处理
|
* 协议Service业务层处理
|
||||||
|
@ -76,17 +74,17 @@ public class AgreementServiceImpl implements AgreementService
|
||||||
contentTypeAreaCheck(agreement);
|
contentTypeAreaCheck(agreement);
|
||||||
agreement.setCreateTime(DateUtils.getNowDate());
|
agreement.setCreateTime(DateUtils.getNowDate());
|
||||||
Integer result = transactionTemplate.execute(status -> {
|
Integer result = transactionTemplate.execute(status -> {
|
||||||
// 创建设备
|
// 创建设备
|
||||||
int insert = agreementMapper.insertAgreement(agreement);
|
int insert = agreementMapper.insertAgreement(agreement);
|
||||||
ServiceUtil.assertion(insert != 1,"新增设备失败");
|
ServiceUtil.assertion(insert != 1,"新增协议失败");
|
||||||
|
|
||||||
// 后校验
|
// 后校验
|
||||||
AgreementVO vo = this.selectAgreementById(agreement.getId());
|
AgreementVO vo = this.selectAgreementById(agreement.getId());
|
||||||
distinct(vo);
|
distinct(vo);
|
||||||
|
|
||||||
return insert;
|
return insert;
|
||||||
|
|
||||||
});
|
});
|
||||||
return result==null? 0 : result;
|
return result==null? 0 : result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -158,4 +156,33 @@ public class AgreementServiceImpl implements AgreementService
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int copyTemplate(AgreementType type, Long areaId) {
|
||||||
|
if (type == null || areaId == null) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询模板
|
||||||
|
AgreementQuery query = new AgreementQuery();
|
||||||
|
query.setAgreementType(type.getCode());
|
||||||
|
query.setContentType(AgreementContentType.TEMPLATE.getCode());
|
||||||
|
AgreementVO template = this.selectOne(query);
|
||||||
|
ServiceUtil.assertion(template == null, "协议模板不存在");
|
||||||
|
|
||||||
|
Agreement data = new Agreement();
|
||||||
|
data.setAreaId(areaId);
|
||||||
|
data.setTitle(template.getTitle());
|
||||||
|
data.setBrief(template.getBrief());
|
||||||
|
data.setContent(template.getContent());
|
||||||
|
data.setAgreementType(template.getAgreementType());
|
||||||
|
data.setContentType(AgreementContentType.TEXT.getCode());
|
||||||
|
data.setDuration(template.getDuration());
|
||||||
|
return this.insertAgreement(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
private AgreementVO selectOne(AgreementQuery query) {
|
||||||
|
PageHelper.startPage(1, 1);
|
||||||
|
List<AgreementVO> list = agreementMapper.selectAgreementList(query);
|
||||||
|
return CollectionUtils.firstElement(list);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,8 +6,11 @@ import java.util.List;
|
||||||
import org.locationtech.jts.geom.Geometry;
|
import org.locationtech.jts.geom.Geometry;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.support.TransactionTemplate;
|
||||||
|
|
||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
|
import com.ruoyi.bst.agreement.domain.enums.AgreementType;
|
||||||
|
import com.ruoyi.bst.agreement.service.AgreementService;
|
||||||
import com.ruoyi.bst.area.domain.Area;
|
import com.ruoyi.bst.area.domain.Area;
|
||||||
import com.ruoyi.bst.area.domain.AreaQuery;
|
import com.ruoyi.bst.area.domain.AreaQuery;
|
||||||
import com.ruoyi.bst.area.domain.AreaVO;
|
import com.ruoyi.bst.area.domain.AreaVO;
|
||||||
|
@ -19,6 +22,7 @@ import com.ruoyi.bst.areaJoin.domain.enums.AreaJoinPermission;
|
||||||
import com.ruoyi.bst.areaSub.domain.AreaSubVO;
|
import com.ruoyi.bst.areaSub.domain.AreaSubVO;
|
||||||
import com.ruoyi.bst.areaSub.service.AreaSubService;
|
import com.ruoyi.bst.areaSub.service.AreaSubService;
|
||||||
import com.ruoyi.common.utils.DateUtils;
|
import com.ruoyi.common.utils.DateUtils;
|
||||||
|
import com.ruoyi.common.utils.ServiceUtil;
|
||||||
import com.ruoyi.common.utils.collection.CollectionUtils;
|
import com.ruoyi.common.utils.collection.CollectionUtils;
|
||||||
import com.ruoyi.common.utils.map.GeoUtils;
|
import com.ruoyi.common.utils.map.GeoUtils;
|
||||||
|
|
||||||
|
@ -40,6 +44,12 @@ public class AreaServiceImpl implements AreaService
|
||||||
@Autowired
|
@Autowired
|
||||||
private AreaSubService areaSubService;
|
private AreaSubService areaSubService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private AgreementService agreementService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private TransactionTemplate transactionTemplate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询运营区
|
* 查询运营区
|
||||||
*
|
*
|
||||||
|
@ -103,7 +113,20 @@ public class AreaServiceImpl implements AreaService
|
||||||
area.setBoundary(GeoUtils.wkt(geometry));
|
area.setBoundary(GeoUtils.wkt(geometry));
|
||||||
}
|
}
|
||||||
area.setCreateTime(DateUtils.getNowDate());
|
area.setCreateTime(DateUtils.getNowDate());
|
||||||
return areaMapper.insertArea(area);
|
|
||||||
|
Integer result = transactionTemplate.execute(status -> {
|
||||||
|
|
||||||
|
int rows = areaMapper.insertArea(area);
|
||||||
|
if (rows > 0) {
|
||||||
|
// 复制一份租赁协议到运营区内
|
||||||
|
int copy = agreementService.copyTemplate(AgreementType.RENT, area.getId());
|
||||||
|
ServiceUtil.assertion(copy != 1, "复制协议模板失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
return rows;
|
||||||
|
});
|
||||||
|
|
||||||
|
return result == null ? 0 : result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -172,7 +195,7 @@ public class AreaServiceImpl implements AreaService
|
||||||
}
|
}
|
||||||
// 查询运营区内的禁行区
|
// 查询运营区内的禁行区
|
||||||
List<AreaSubVO> noRidingList = areaSubService.selectNoRidingListByAreaId(areaId);
|
List<AreaSubVO> noRidingList = areaSubService.selectNoRidingListByAreaId(areaId);
|
||||||
|
|
||||||
return AreaUtil.getLocationArea(lon, lat, area, noRidingList);
|
return AreaUtil.getLocationArea(lon, lat, area, noRidingList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,6 @@ package com.ruoyi.bst.customerService.service.impl;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.ruoyi.common.utils.ServiceUtil;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@ -47,6 +46,7 @@ public class CustomerServiceServiceImpl implements CustomerServiceService
|
||||||
CustomerServiceQuery query = new CustomerServiceQuery();
|
CustomerServiceQuery query = new CustomerServiceQuery();
|
||||||
query.setId(id);
|
query.setId(id);
|
||||||
query.setScope(scope);
|
query.setScope(scope);
|
||||||
|
query.addAreaPermission(AreaJoinPermission.CUSTOMER_SERVICE_VIEW.getCode());
|
||||||
return this.selectOne(query);
|
return this.selectOne(query);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package com.ruoyi.iot.service.impl;
|
package com.ruoyi.iot.service.impl;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -70,10 +69,6 @@ public class IotConverterImpl implements IotConverter {
|
||||||
if (sys == null) {
|
if (sys == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// 旧版硬件BUG,电压超过100V的需要除以10
|
|
||||||
if (sys.getBat() != null && sys.getBat().compareTo(BigDecimal.valueOf(100)) >= 0) {
|
|
||||||
sys.setBat(sys.getBat().divide(BigDecimal.valueOf(10), 2, BigDecimal.ROUND_HALF_UP));
|
|
||||||
}
|
|
||||||
device.setSys(sys);
|
device.setSys(sys);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -85,9 +85,16 @@ public class IotReceiveServiceImpl implements IotReceiveService {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 转为设备信息
|
// 转为设备信息
|
||||||
|
log.info("收到sys数据:" + msg.getValue());
|
||||||
IotDeviceSysInfo sys = IotUtil.toSysInfo(msg.getValue());
|
IotDeviceSysInfo sys = IotUtil.toSysInfo(msg.getValue());
|
||||||
LocalDateTime at = DateUtils.toLocalDateTime(msg.getAt());
|
LocalDateTime at = DateUtils.toLocalDateTime(msg.getAt());
|
||||||
|
|
||||||
|
// 0,0定位不处理
|
||||||
|
if (MathUtils.equals(sys.getLon(), BigDecimal.ZERO) && MathUtils.equals(sys.getLat(), BigDecimal.ZERO)) {
|
||||||
|
log.info("设备{}定位异常:{},{},不处理", msg.getDevName(), sys.getLon(), sys.getLat());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// 处理设备定位BUG,若出现BUG则重启设备
|
// 处理设备定位BUG,若出现BUG则重启设备
|
||||||
int handle = this.handleDeviceLocationBug(device, sys, at);
|
int handle = this.handleDeviceLocationBug(device, sys, at);
|
||||||
if (handle == 1) {
|
if (handle == 1) {
|
||||||
|
@ -135,10 +142,6 @@ public class IotReceiveServiceImpl implements IotReceiveService {
|
||||||
if (device == null || StringUtils.isBlank(device.getMac()) || device.getLastLocationTime() == null || at == null) {
|
if (device == null || StringUtils.isBlank(device.getMac()) || device.getLastLocationTime() == null || at == null) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
// 0,0定位不处理
|
|
||||||
if (MathUtils.equals(sys.getLon(), BigDecimal.ZERO) && MathUtils.equals(sys.getLat(), BigDecimal.ZERO)) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
// 相差一分钟以上的消息不做处理
|
// 相差一分钟以上的消息不做处理
|
||||||
Duration duration = Duration.between(at, LocalDateTime.now());
|
Duration duration = Duration.between(at, LocalDateTime.now());
|
||||||
if (duration.getSeconds() > 60) {
|
if (duration.getSeconds() > 60) {
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package com.ruoyi.iot.util;
|
package com.ruoyi.iot.util;
|
||||||
|
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.security.InvalidAlgorithmParameterException;
|
import java.security.InvalidAlgorithmParameterException;
|
||||||
import java.security.InvalidKeyException;
|
import java.security.InvalidKeyException;
|
||||||
|
@ -220,6 +221,13 @@ public class IotUtil {
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return JSON.parseObject(value.toString(), IotDeviceSysInfo.class);
|
IotDeviceSysInfo sys = JSON.parseObject(value.toString(), IotDeviceSysInfo.class);
|
||||||
|
|
||||||
|
// 旧版硬件BUG,电压超过100V的需要除以10
|
||||||
|
if (sys.getBat() != null && sys.getBat().compareTo(BigDecimal.valueOf(100)) >= 0) {
|
||||||
|
sys.setBat(sys.getBat().divide(BigDecimal.valueOf(10), 2, BigDecimal.ROUND_HALF_UP));
|
||||||
|
}
|
||||||
|
|
||||||
|
return sys;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,8 +4,6 @@ import java.util.List;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import com.ruoyi.bst.agreement.service.AgreementConverter;
|
|
||||||
import com.ruoyi.common.core.validate.ValidGroup;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
@ -21,12 +19,14 @@ import org.springframework.web.bind.annotation.RestController;
|
||||||
import com.ruoyi.bst.agreement.domain.Agreement;
|
import com.ruoyi.bst.agreement.domain.Agreement;
|
||||||
import com.ruoyi.bst.agreement.domain.AgreementQuery;
|
import com.ruoyi.bst.agreement.domain.AgreementQuery;
|
||||||
import com.ruoyi.bst.agreement.domain.AgreementVO;
|
import com.ruoyi.bst.agreement.domain.AgreementVO;
|
||||||
|
import com.ruoyi.bst.agreement.service.AgreementConverter;
|
||||||
import com.ruoyi.bst.agreement.service.AgreementService;
|
import com.ruoyi.bst.agreement.service.AgreementService;
|
||||||
import com.ruoyi.bst.agreement.service.AgreementValidator;
|
import com.ruoyi.bst.agreement.service.AgreementValidator;
|
||||||
import com.ruoyi.common.annotation.Log;
|
import com.ruoyi.common.annotation.Log;
|
||||||
import com.ruoyi.common.core.controller.BaseController;
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
import com.ruoyi.common.core.domain.AjaxResult;
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
import com.ruoyi.common.core.page.TableDataInfo;
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
|
import com.ruoyi.common.core.validate.ValidGroup;
|
||||||
import com.ruoyi.common.enums.BusinessType;
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
import com.ruoyi.common.enums.LogBizType;
|
import com.ruoyi.common.enums.LogBizType;
|
||||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
|
|
|
@ -17,6 +17,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import com.ruoyi.bst.area.service.AreaService;
|
import com.ruoyi.bst.area.service.AreaService;
|
||||||
import com.ruoyi.bst.area.service.AreaValidator;
|
import com.ruoyi.bst.area.service.AreaValidator;
|
||||||
|
import com.ruoyi.bst.areaJoin.domain.enums.AreaJoinPermission;
|
||||||
import com.ruoyi.bst.customerService.domain.CustomerService;
|
import com.ruoyi.bst.customerService.domain.CustomerService;
|
||||||
import com.ruoyi.bst.customerService.domain.CustomerServiceQuery;
|
import com.ruoyi.bst.customerService.domain.CustomerServiceQuery;
|
||||||
import com.ruoyi.bst.customerService.domain.CustomerServiceVO;
|
import com.ruoyi.bst.customerService.domain.CustomerServiceVO;
|
||||||
|
@ -62,6 +63,7 @@ public class CustomerServiceController extends BaseController
|
||||||
startPage();
|
startPage();
|
||||||
startOrderBy();
|
startOrderBy();
|
||||||
query.setScope(true);
|
query.setScope(true);
|
||||||
|
query.addAreaPermission(AreaJoinPermission.CUSTOMER_SERVICE_VIEW.getCode());
|
||||||
List<CustomerServiceVO> list = customerServiceService.selectCustomerServiceList(query);
|
List<CustomerServiceVO> list = customerServiceService.selectCustomerServiceList(query);
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
}
|
}
|
||||||
|
@ -75,6 +77,7 @@ public class CustomerServiceController extends BaseController
|
||||||
public void export(HttpServletResponse response, CustomerServiceQuery query)
|
public void export(HttpServletResponse response, CustomerServiceQuery query)
|
||||||
{
|
{
|
||||||
query.setScope(true);
|
query.setScope(true);
|
||||||
|
query.addAreaPermission(AreaJoinPermission.CUSTOMER_SERVICE_VIEW.getCode());
|
||||||
List<CustomerServiceVO> list = customerServiceService.selectCustomerServiceList(query);
|
List<CustomerServiceVO> list = customerServiceService.selectCustomerServiceList(query);
|
||||||
ExcelUtil<CustomerServiceVO> util = new ExcelUtil<CustomerServiceVO>(CustomerServiceVO.class);
|
ExcelUtil<CustomerServiceVO> util = new ExcelUtil<CustomerServiceVO>(CustomerServiceVO.class);
|
||||||
util.exportExcel(response, list, "客服数据");
|
util.exportExcel(response, list, "客服数据");
|
||||||
|
|
Loading…
Reference in New Issue
Block a user