|
@ -23,6 +23,7 @@ import com.qs.serve.modules.sys.service.SysUserService; |
|
|
import com.qs.serve.modules.tag.TagTypeConst; |
|
|
import com.qs.serve.modules.tag.TagTypeConst; |
|
|
import com.qs.serve.modules.tag.entity.TagData; |
|
|
import com.qs.serve.modules.tag.entity.TagData; |
|
|
import com.qs.serve.modules.tag.entity.TagInfo; |
|
|
import com.qs.serve.modules.tag.entity.TagInfo; |
|
|
|
|
|
import com.qs.serve.modules.tag.entity.bo.TagInfoApiBindBo; |
|
|
import com.qs.serve.modules.tag.entity.bo.TagInfoBindBo; |
|
|
import com.qs.serve.modules.tag.entity.bo.TagInfoBindBo; |
|
|
import com.qs.serve.modules.tag.entity.bo.TagInfoBo; |
|
|
import com.qs.serve.modules.tag.entity.bo.TagInfoBo; |
|
|
import com.qs.serve.modules.tag.entity.so.TagDataSo; |
|
|
import com.qs.serve.modules.tag.entity.so.TagDataSo; |
|
@ -59,6 +60,7 @@ public class TagDataController { |
|
|
private BmsChannelService bmsChannelService; |
|
|
private BmsChannelService bmsChannelService; |
|
|
private SysUserService sysUserService; |
|
|
private SysUserService sysUserService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 批量获取标签 |
|
|
* 批量获取标签 |
|
|
* @param param |
|
|
* @param param |
|
@ -84,6 +86,71 @@ public class TagDataController { |
|
|
return R.ok(tagDataVoList); |
|
|
return R.ok(tagDataVoList); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 删除(对接JSL接口) |
|
|
|
|
|
* @param param |
|
|
|
|
|
* @return |
|
|
|
|
|
*/ |
|
|
|
|
|
@PostMapping("/apiDelete") |
|
|
|
|
|
@SysLog(module = SystemModule.Tag, title = "标签信息", biz = BizType.DELETE) |
|
|
|
|
|
public R<?> apiDelete(@RequestBody @Valid TagInfoApiBindBo param){ |
|
|
|
|
|
TagInfo tagInfo = tagInfoService.getOne(new LambdaQueryWrapper<TagInfo>() |
|
|
|
|
|
.eq(TagInfo::getTagCode,param.getTagCode())); |
|
|
|
|
|
if(tagInfo==null){ |
|
|
|
|
|
return R.error("无效的标签编码"); |
|
|
|
|
|
} |
|
|
|
|
|
tagDataService.remove(new LambdaQueryWrapper<TagData>() |
|
|
|
|
|
.eq(TagData::getTargetType,param.getTargetType()) |
|
|
|
|
|
.eq(TagData::getTagId,tagInfo.getId()) |
|
|
|
|
|
.in(TagData::getTargetCode,param.getTargetCodeList()) |
|
|
|
|
|
); |
|
|
|
|
|
return R.ok(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 新增(对接JSL接口) |
|
|
|
|
|
* @param param |
|
|
|
|
|
* @return |
|
|
|
|
|
*/ |
|
|
|
|
|
@PostMapping("/apiSave") |
|
|
|
|
|
@SysLog(module = SystemModule.Tag, title = "标签信息", biz = BizType.INSERT) |
|
|
|
|
|
public R<?> apiSave(@RequestBody @Valid TagInfoApiBindBo param){ |
|
|
|
|
|
if(CollUtil.isEmpty(param.getTargetCodeList())){ |
|
|
|
|
|
return R.error("编码列表不能为空"); |
|
|
|
|
|
} |
|
|
|
|
|
TagInfo tagInfo = tagInfoService.getOne(new LambdaQueryWrapper<TagInfo>() |
|
|
|
|
|
.eq(TagInfo::getTagCode,param.getTagCode())); |
|
|
|
|
|
if(tagInfo==null){ |
|
|
|
|
|
return R.error("无效的标签编码"); |
|
|
|
|
|
} |
|
|
|
|
|
List<TagData> tagDataList = new ArrayList<>(); |
|
|
|
|
|
if(param.getTargetType().equals(TagTypeConst.Customer)){ |
|
|
|
|
|
List<BmsSupplier> bmsSuppliers = bmsSupplierService.list(new LambdaQueryWrapper<BmsSupplier>() |
|
|
|
|
|
.in(BmsSupplier::getCode,param.getTargetCodeList())); |
|
|
|
|
|
for (BmsSupplier supplier : bmsSuppliers) { |
|
|
|
|
|
TagData data = new TagData(); |
|
|
|
|
|
data.setTenantId(supplier.getId()); |
|
|
|
|
|
data.setTargetCode(supplier.getCode()); |
|
|
|
|
|
data.setTargetName(supplier.getName()); |
|
|
|
|
|
tagDataList.add(data); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
//其它类型暂未用的上
|
|
|
|
|
|
// else if (param.getTargetType().equals(TagTypeConst.Channel)){
|
|
|
|
|
|
// BmsChannel channel = bmsChannelService.getById(objectDTO.getTargetId());
|
|
|
|
|
|
// }else if (param.getTargetType().equals(TagTypeConst.Point)){
|
|
|
|
|
|
// BmsChannelPoint point = bmsChannelPointService.getById(objectDTO.getTargetId());
|
|
|
|
|
|
// }else{
|
|
|
|
|
|
// SysUser sysUser = sysUserService.getById(objectDTO.getTargetId());
|
|
|
|
|
|
// }
|
|
|
|
|
|
for (TagData data : tagDataList) { |
|
|
|
|
|
data.setTargetType(param.getTargetType()); |
|
|
|
|
|
data.setTagName(tagInfo.getTagName()); |
|
|
|
|
|
data.setTagId(tagInfo.getId()); |
|
|
|
|
|
} |
|
|
|
|
|
return R.ok(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 新增 |
|
|
* 新增 |
|
|
* @param param |
|
|
* @param param |
|
|