多端同时提交

This commit is contained in:
guohb
2024-06-05 18:01:14 +08:00
parent 4a433d7743
commit 7ba6b0d709
3 changed files with 12 additions and 0 deletions

View File

@@ -8,4 +8,7 @@ import org.apache.ibatis.annotations.Param;
public interface SystemBuildingShopMapper extends tk.mybatis.mapper.common.Mapper<SystemBuildingShopDO> { public interface SystemBuildingShopMapper extends tk.mybatis.mapper.common.Mapper<SystemBuildingShopDO> {
void updateAuditByShopId(@Param("auditId") Long auditId, void updateAuditByShopId(@Param("auditId") Long auditId,
@Param("shopId") Long shopId); @Param("shopId") Long shopId);
SystemBuildingShopDO selectByShopId(@Param("shopId") Long shopId);
} }

View File

@@ -13,5 +13,10 @@
set audit_id = #{auditId} set audit_id = #{auditId}
where shop_id = #{shopId} where shop_id = #{shopId}
</update> </update>
<select id="selectByShopId" resultType="com.cool.store.entity.SystemBuildingShopDO">
select * from xfsg_system_building_shop
where shop_id = #{shopId};
</select>
</mapper> </mapper>

View File

@@ -95,6 +95,10 @@ public class SysStoreAppServiceImpl implements SysStoreAppService, AuditResultSe
if (Objects.isNull(request)) { if (Objects.isNull(request)) {
throw new ServiceException(ErrorCodeEnum.PARAMS_VALIDATE_ERROR); throw new ServiceException(ErrorCodeEnum.PARAMS_VALIDATE_ERROR);
} }
SystemBuildingShopDO isExist = systemBuildingShopMapper.selectByShopId(request.getShopId());
if (Objects.nonNull(isExist) && Objects.isNull(request.getId())){
throw new ServiceException(ErrorCodeEnum.DUPLICATE_SUBMISSION);
}
String lockKey = "submitSysBuildStore:" + request.getShopId(); String lockKey = "submitSysBuildStore:" + request.getShopId();
String lockValue = UUID.randomUUID().toString(); String lockValue = UUID.randomUUID().toString();
boolean acquired = false; boolean acquired = false;