协议前后端完善

This commit is contained in:
SjS 2025-04-09 10:03:35 +08:00
parent 6e34237028
commit 7fbb4c8349
5 changed files with 21 additions and 11 deletions

View File

@ -13,4 +13,7 @@ public class AgreementVO extends Agreement{
@ApiModelProperty("运营区") @ApiModelProperty("运营区")
private String areaName; private String areaName;
@ApiModelProperty("运营商ID")
private Long agentId;
} }

View File

@ -39,13 +39,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</sql> </sql>
<sql id="searchCondition"> <sql id="searchCondition">
<if test="query.storeId != null "> and store_id = #{query.storeId}</if> <if test="query.storeId != null "> and bag.store_id = #{query.storeId}</if>
<if test="query.areaId != null "> and 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 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 brief like concat('%', #{query.brief}, '%')</if> <if test="query.brief != null and query.brief != ''"> and bag.brief like concat('%', #{query.brief}, '%')</if>
<if test="query.content != null and query.content != ''"> and content like concat('%', #{query.content}, '%')</if> <if test="query.content != null and query.content != ''"> and bag.content like concat('%', #{query.content}, '%')</if>
<if test="query.agreementType != null and query.agreementType != ''"> and agreement_type = #{query.agreementType}</if> <if test="query.agreementType != null and query.agreementType != ''"> and bag.agreement_type = #{query.agreementType}</if>
<if test="query.duration != null "> and duration = #{query.duration}</if> <if test="query.duration != null "> and bag.duration = #{query.duration}</if>
${@com.ruoyi.framework.util.DataScopeUtil@dataScope( ${@com.ruoyi.framework.util.DataScopeUtil@dataScope(
null, null,
"bag.store_id", "bag.store_id",

View File

@ -28,8 +28,6 @@ public class AgreementServiceImpl implements AgreementService
@Autowired @Autowired
private AgreementMapper agreementMapper; private AgreementMapper agreementMapper;
@Autowired @Autowired
private UserService userService;
@Autowired
private AreaService areaService; private AreaService areaService;
/** /**
@ -66,6 +64,10 @@ public class AgreementServiceImpl implements AgreementService
public int insertAgreement(Agreement agreement) public int insertAgreement(Agreement agreement)
{ {
agreement.setCreateTime(DateUtils.getNowDate()); agreement.setCreateTime(DateUtils.getNowDate());
AreaVO area = areaService.selectAreaById(agreement.getAreaId());
if (area !=null){
agreement.setStoreId(area.getUserId());
};
distinct(agreement); distinct(agreement);
return agreementMapper.insertAgreement(agreement); return agreementMapper.insertAgreement(agreement);
} }

View File

@ -4,6 +4,7 @@ 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.mapper.AgreementMapper; import com.ruoyi.bst.agreement.mapper.AgreementMapper;
import com.ruoyi.bst.agreement.service.AgreementValidator; import com.ruoyi.bst.agreement.service.AgreementValidator;
import com.ruoyi.bst.area.domain.AreaVO;
import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.collection.CollectionUtils; import com.ruoyi.common.utils.collection.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -53,7 +54,7 @@ public class AgreementValidatorImpl implements AgreementValidator {
if (agreement == null) { if (agreement == null) {
return false; return false;
} }
boolean canOperate = isMch(agreement, userId); boolean canOperate = isMch(agreement, userId) || isAgent(agreement,userId);
if (!canOperate) { if (!canOperate) {
return false; return false;
} }
@ -62,6 +63,11 @@ public class AgreementValidatorImpl implements AgreementValidator {
return true; return true;
} }
private boolean isAgent(AgreementVO agreement, Long userId) {
return agreement != null && agreement.getAgentId() != null && agreement.getAgentId().equals(userId);
}
private boolean isMch(AgreementVO agreement, Long userId) { private boolean isMch(AgreementVO agreement, Long userId) {
return agreement != null && agreement.getStoreId() != null && agreement.getStoreId().equals(userId); return agreement != null && agreement.getStoreId() != null && agreement.getStoreId().equals(userId);
} }

View File

@ -78,7 +78,6 @@ public class AgreementController extends BaseController
@PostMapping @PostMapping
public AjaxResult add(@RequestBody Agreement agreement) public AjaxResult add(@RequestBody Agreement agreement)
{ {
agreement.setStoreId(getUserId());
return toAjax(agreementService.insertAgreement(agreement)); return toAjax(agreementService.insertAgreement(agreement));
} }