Merge remote-tracking branch 'origin/wjh'
# Conflicts: # ruoyi-service/src/main/java/com/ruoyi/bst/agreement/mapper/AgreementMapper.xml
This commit is contained in:
commit
d5b31fded3
|
@ -1,16 +1,16 @@
|
|||
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.core.domain.BaseEntity;
|
||||
import com.ruoyi.common.core.interfaces.LogBizParam;
|
||||
|
||||
import com.ruoyi.common.core.validate.ValidGroup;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 协议对象 bst_agreement
|
||||
*
|
||||
|
@ -23,11 +23,7 @@ public class Agreement extends BaseEntity implements LogBizParam
|
|||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Long id;
|
||||
|
||||
@Excel(name = "商户ID")
|
||||
@ApiModelProperty("商户ID")
|
||||
private Long storeId;
|
||||
|
||||
|
||||
@Excel(name = "运营区ID")
|
||||
@ApiModelProperty("运营区ID")
|
||||
private Long areaId;
|
||||
|
|
|
@ -7,6 +7,9 @@ import lombok.Data;
|
|||
public class AgreementVO extends Agreement{
|
||||
|
||||
|
||||
@ApiModelProperty("商户ID")
|
||||
private Long storeId;
|
||||
|
||||
@ApiModelProperty("商户名")
|
||||
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 batchInsert(@Param("list") List<? extends Agreement> list);
|
||||
|
||||
/**
|
||||
* 批量修改协议
|
||||
*/
|
||||
int batchUpdate(@Param("list") List<? extends Agreement> list);
|
||||
|
||||
/**
|
||||
* 修改协议
|
||||
*
|
||||
|
|
|
@ -9,6 +9,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<sql id="selectAgreementVo">
|
||||
select
|
||||
bag.id,
|
||||
bag.store_id,
|
||||
bag.area_id,
|
||||
bag.title,
|
||||
bag.brief,
|
||||
|
@ -32,6 +33,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</sql>
|
||||
|
||||
<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.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>
|
||||
|
@ -45,7 +47,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<foreach collection="query.ids" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
</if>
|
||||
${@com.ruoyi.framework.util.DataScopeUtil@dataScope(
|
||||
null,
|
||||
"ba.user_id,su.agent_id",
|
||||
|
@ -65,7 +67,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
|
||||
<select id="selectAgreementById" parameterType="Long" resultMap="AgreementResult">
|
||||
<include refid="selectAgreementVo"/>
|
||||
where bag.id = #{id}
|
||||
where bag.id = #{id}
|
||||
</select>
|
||||
|
||||
|
||||
|
@ -103,131 +105,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</trim>
|
||||
</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 bst_agreement bag
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
package com.ruoyi.bst.agreement.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
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.AgreementVO;
|
||||
import com.ruoyi.bst.agreement.domain.enums.AgreementType;
|
||||
|
||||
/**
|
||||
* 协议Service接口
|
||||
|
@ -61,4 +63,12 @@ public interface AgreementService
|
|||
*/
|
||||
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());
|
||||
if (SecurityUtils.isAdmin()){
|
||||
po.setContentType(data.getContentType());
|
||||
}else po.setContentType(AgreementContentType.TEXT.getCode());
|
||||
}else po.setContentType(
|
||||
AgreementContentType.TEXT.getCode()
|
||||
);
|
||||
po.setAgreementType(data.getAgreementType());
|
||||
po.setBrief(data.getBrief());
|
||||
po.setContent(data.getContent());
|
||||
|
|
|
@ -2,25 +2,23 @@ package com.ruoyi.bst.agreement.service.impl;
|
|||
|
||||
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.area.domain.AreaQuery;
|
||||
import com.ruoyi.bst.area.domain.AreaVO;
|
||||
import com.ruoyi.bst.agreement.domain.enums.AgreementType;
|
||||
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.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.ServiceUtil;
|
||||
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业务层处理
|
||||
|
@ -76,17 +74,17 @@ public class AgreementServiceImpl implements AgreementService
|
|||
contentTypeAreaCheck(agreement);
|
||||
agreement.setCreateTime(DateUtils.getNowDate());
|
||||
Integer result = transactionTemplate.execute(status -> {
|
||||
// 创建设备
|
||||
int insert = agreementMapper.insertAgreement(agreement);
|
||||
ServiceUtil.assertion(insert != 1,"新增设备失败");
|
||||
// 创建设备
|
||||
int insert = agreementMapper.insertAgreement(agreement);
|
||||
ServiceUtil.assertion(insert != 1,"新增协议失败");
|
||||
|
||||
// 后校验
|
||||
AgreementVO vo = this.selectAgreementById(agreement.getId());
|
||||
distinct(vo);
|
||||
// 后校验
|
||||
AgreementVO vo = this.selectAgreementById(agreement.getId());
|
||||
distinct(vo);
|
||||
|
||||
return insert;
|
||||
return insert;
|
||||
|
||||
});
|
||||
});
|
||||
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.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.support.TransactionTemplate;
|
||||
|
||||
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.AreaQuery;
|
||||
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.service.AreaSubService;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.common.utils.ServiceUtil;
|
||||
import com.ruoyi.common.utils.collection.CollectionUtils;
|
||||
import com.ruoyi.common.utils.map.GeoUtils;
|
||||
|
||||
|
@ -40,6 +44,12 @@ public class AreaServiceImpl implements AreaService
|
|||
@Autowired
|
||||
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.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);
|
||||
|
||||
|
||||
return AreaUtil.getLocationArea(lon, lat, area, noRidingList);
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@ package com.ruoyi.bst.customerService.service.impl;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.common.utils.ServiceUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
@ -47,6 +46,7 @@ public class CustomerServiceServiceImpl implements CustomerServiceService
|
|||
CustomerServiceQuery query = new CustomerServiceQuery();
|
||||
query.setId(id);
|
||||
query.setScope(scope);
|
||||
query.addAreaPermission(AreaJoinPermission.CUSTOMER_SERVICE_VIEW.getCode());
|
||||
return this.selectOne(query);
|
||||
}
|
||||
|
||||
|
|
|
@ -85,6 +85,7 @@ public class IotReceiveServiceImpl implements IotReceiveService {
|
|||
}
|
||||
|
||||
// 转为设备信息
|
||||
log.info("收到sys数据:" + msg.getValue());
|
||||
IotDeviceSysInfo sys = IotUtil.toSysInfo(msg.getValue());
|
||||
LocalDateTime at = DateUtils.toLocalDateTime(msg.getAt());
|
||||
|
||||
|
|
|
@ -4,8 +4,6 @@ import java.util.List;
|
|||
|
||||
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.security.access.prepost.PreAuthorize;
|
||||
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.AgreementQuery;
|
||||
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.AgreementValidator;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
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.LogBizType;
|
||||
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.AreaValidator;
|
||||
import com.ruoyi.bst.areaJoin.domain.enums.AreaJoinPermission;
|
||||
import com.ruoyi.bst.customerService.domain.CustomerService;
|
||||
import com.ruoyi.bst.customerService.domain.CustomerServiceQuery;
|
||||
import com.ruoyi.bst.customerService.domain.CustomerServiceVO;
|
||||
|
@ -62,6 +63,7 @@ public class CustomerServiceController extends BaseController
|
|||
startPage();
|
||||
startOrderBy();
|
||||
query.setScope(true);
|
||||
query.addAreaPermission(AreaJoinPermission.CUSTOMER_SERVICE_VIEW.getCode());
|
||||
List<CustomerServiceVO> list = customerServiceService.selectCustomerServiceList(query);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
@ -75,6 +77,7 @@ public class CustomerServiceController extends BaseController
|
|||
public void export(HttpServletResponse response, CustomerServiceQuery query)
|
||||
{
|
||||
query.setScope(true);
|
||||
query.addAreaPermission(AreaJoinPermission.CUSTOMER_SERVICE_VIEW.getCode());
|
||||
List<CustomerServiceVO> list = customerServiceService.selectCustomerServiceList(query);
|
||||
ExcelUtil<CustomerServiceVO> util = new ExcelUtil<CustomerServiceVO>(CustomerServiceVO.class);
|
||||
util.exportExcel(response, list, "客服数据");
|
||||
|
|
Loading…
Reference in New Issue
Block a user