协议数据
This commit is contained in:
parent
828d8d3de0
commit
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
|
||||||
*
|
*
|
||||||
|
@ -24,10 +24,6 @@ public class Agreement extends BaseEntity implements LogBizParam
|
||||||
|
|
||||||
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;
|
||||||
|
|
|
@ -7,6 +7,9 @@ import lombok.Data;
|
||||||
public class AgreementVO extends Agreement{
|
public class AgreementVO extends Agreement{
|
||||||
|
|
||||||
|
|
||||||
|
@ApiModelProperty("商户ID")
|
||||||
|
private Long storeId;
|
||||||
|
|
||||||
@ApiModelProperty("商户名")
|
@ApiModelProperty("商户名")
|
||||||
private String userName;
|
private String userName;
|
||||||
|
|
||||||
|
|
|
@ -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);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改协议
|
* 修改协议
|
||||||
*
|
*
|
||||||
|
|
|
@ -9,7 +9,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<sql id="selectAgreementVo">
|
<sql id="selectAgreementVo">
|
||||||
select
|
select
|
||||||
bag.id,
|
bag.id,
|
||||||
bag.store_id,
|
|
||||||
bag.area_id,
|
bag.area_id,
|
||||||
bag.title,
|
bag.title,
|
||||||
bag.brief,
|
bag.brief,
|
||||||
|
@ -20,18 +19,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
bag.create_time,
|
bag.create_time,
|
||||||
bag.update_time,
|
bag.update_time,
|
||||||
su.nick_name as user_name,
|
su.nick_name as user_name,
|
||||||
ba.name as area_name
|
ba.name as area_name,
|
||||||
|
ba.user_id as store_id
|
||||||
from <include refid="searchTables"/>
|
from <include refid="searchTables"/>
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<sql id="searchTables">
|
<sql id="searchTables">
|
||||||
bst_agreement bag
|
bst_agreement bag
|
||||||
left join sys_user su on bag.store_id = su.user_id
|
|
||||||
left join bst_area ba on bag.area_id = ba.id
|
left join bst_area ba on bag.area_id = ba.id
|
||||||
|
left join sys_user su on ba.user_id = su.user_id
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<sql id="searchCondition">
|
<sql id="searchCondition">
|
||||||
<if test="query.storeId != null "> and bag.store_id = #{query.storeId}</if>
|
<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>
|
||||||
|
@ -48,7 +48,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
</if>
|
</if>
|
||||||
${@com.ruoyi.framework.util.DataScopeUtil@dataScope(
|
${@com.ruoyi.framework.util.DataScopeUtil@dataScope(
|
||||||
null,
|
null,
|
||||||
"bag.store_id",
|
"ba.user_id",
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
query.scope
|
query.scope
|
||||||
|
@ -80,7 +80,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<insert id="insertAgreement" parameterType="Agreement" useGeneratedKeys="true" keyProperty="id">
|
<insert id="insertAgreement" parameterType="Agreement" useGeneratedKeys="true" keyProperty="id">
|
||||||
insert into bst_agreement
|
insert into bst_agreement
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
<if test="storeId != null">store_id,</if>
|
|
||||||
<if test="areaId != null">area_id,</if>
|
<if test="areaId != null">area_id,</if>
|
||||||
<if test="title != null and title != ''">title,</if>
|
<if test="title != null and title != ''">title,</if>
|
||||||
<if test="brief != null">brief,</if>
|
<if test="brief != null">brief,</if>
|
||||||
|
@ -92,7 +91,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="updateTime != null">update_time,</if>
|
<if test="updateTime != null">update_time,</if>
|
||||||
</trim>
|
</trim>
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
<if test="storeId != null">#{storeId},</if>
|
|
||||||
<if test="areaId != null">#{areaId},</if>
|
<if test="areaId != null">#{areaId},</if>
|
||||||
<if test="title != null and title != ''">#{title},</if>
|
<if test="title != null and title != ''">#{title},</if>
|
||||||
<if test="brief != null">#{brief},</if>
|
<if test="brief != null">#{brief},</if>
|
||||||
|
@ -105,144 +103,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=",">
|
|
||||||
store_id,
|
|
||||||
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.storeId != null ">#{i.storeId},</if>
|
|
||||||
<if test="i.storeId == null ">default,</if>
|
|
||||||
<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="store_id = CASE id" collection="list" item="item" close="END,">
|
|
||||||
<choose>
|
|
||||||
<when test="item.storeId != null ">
|
|
||||||
WHEN #{item.id} THEN #{item.storeId}
|
|
||||||
</when>
|
|
||||||
<otherwise>
|
|
||||||
WHEN #{item.id} THEN `store_id`
|
|
||||||
</otherwise>
|
|
||||||
</choose>
|
|
||||||
</foreach>
|
|
||||||
<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=",">
|
||||||
|
@ -252,7 +112,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<sql id="updateColumns">
|
<sql id="updateColumns">
|
||||||
<if test="data.storeId != null">store_id = #{data.storeId},</if>
|
|
||||||
<if test="data.areaId != null">area_id = #{data.areaId},</if>
|
<if test="data.areaId != null">area_id = #{data.areaId},</if>
|
||||||
<if test="data.title != null and data.title != ''">title = #{data.title},</if>
|
<if test="data.title != null and data.title != ''">title = #{data.title},</if>
|
||||||
<if test="data.brief != null">brief = #{data.brief},</if>
|
<if test="data.brief != null">brief = #{data.brief},</if>
|
||||||
|
|
|
@ -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业务层处理
|
||||||
|
@ -78,7 +76,7 @@ public class AgreementServiceImpl implements AgreementService
|
||||||
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());
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -85,6 +85,7 @@ 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());
|
||||||
|
|
||||||
|
|
|
@ -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