1、增加单位图标管理
2、修改机构登录 3、订单问题处理 4、完善组态绑定及删除关联
This commit is contained in:
@@ -71,4 +71,6 @@ public interface ScadaDeviceBindMapper
|
||||
List<ScadaBindDeviceSimVO> listDeviceSimByGuid(String guid);
|
||||
|
||||
List<ScadaDeviceBind> selectScadaDeviceBindListByIds(List<String> guidList);
|
||||
|
||||
int deleteScadaDeviceBindByGuid(@Param("scadaGuid") String scadaGuid);
|
||||
}
|
||||
|
||||
@@ -107,7 +107,8 @@ public interface ScadaMapper
|
||||
void updateSceneModelGuid( @Param("sceneModelId") Long sceneModelId, @Param("guid") String guid);
|
||||
|
||||
void updateDeviceGuid( @Param("serialNumber") String serialNumber, @Param("guid") String guid);
|
||||
|
||||
void resetDeviceGuid(@Param("guid") String guid);
|
||||
void resetProductGuid(@Param("guid") String guid);
|
||||
void deleteProductByGuids(List<String> guids);
|
||||
|
||||
void deleteSceneModelByGuids(List<String> guids);
|
||||
@@ -117,4 +118,7 @@ public interface ScadaMapper
|
||||
Long selectSceneModelByGuid(String guid);
|
||||
|
||||
String selectSerialNumberByGuid(String guid);
|
||||
|
||||
|
||||
Long selectDeptIdBySn(@Param("serialNumber") String serialNumber);
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ import com.xinda.common.utils.MessageUtils;
|
||||
import com.xinda.common.utils.StringUtils;
|
||||
import com.xinda.common.utils.bean.BeanUtils;
|
||||
import com.xinda.common.utils.file.FileUploadUtils;
|
||||
import com.xinda.iot.domain.Device;
|
||||
import com.xinda.iot.domain.DeviceLog;
|
||||
import com.xinda.iot.domain.EventLog;
|
||||
import com.xinda.iot.domain.FunctionLog;
|
||||
@@ -32,6 +33,7 @@ import com.xinda.scada.service.IScadaService;
|
||||
import com.xinda.scada.vo.*;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
@@ -145,13 +147,18 @@ public class ScadaServiceImpl implements IScadaService
|
||||
UUID uuid = UUID.randomUUID();
|
||||
scadaVO.setGuid(uuid.toString());
|
||||
Scada scada = ScadaConvert.INSTANCE.convertScada(scadaVO);
|
||||
scada.setDeptId(user.getDept().getDeptId());
|
||||
// scada.setDeptId(user.getDept().getDeptId());
|
||||
scada.setDeptId(scadaMapper.selectDeptIdBySn(scadaVO.getSerialNumber()));
|
||||
int result = scadaMapper.insertScada(scada);
|
||||
if (result >0){
|
||||
if (ScadaTypeEnum.PRODUCT_TEMPLATE.getType().equals(scadaVO.getType())) {
|
||||
scadaMapper.updateProductGuid(scadaVO.getProductId(), uuid.toString());
|
||||
}
|
||||
if (ScadaTypeEnum.SCENE_MODEL.getType().equals(scadaVO.getType())) {
|
||||
ScadaDeviceBind scadaDeviceBind = new ScadaDeviceBind();
|
||||
scadaDeviceBind.setSerialNumber(scadaVO.getSerialNumber());
|
||||
scadaDeviceBind.setScadaGuid(uuid.toString());
|
||||
scadaDeviceBindMapper.insertScadaDeviceBind(scadaDeviceBind);
|
||||
scadaMapper.updateDeviceGuid(scadaVO.getSerialNumber(), uuid.toString());
|
||||
}
|
||||
return AjaxResult.success(uuid.toString());
|
||||
@@ -238,8 +245,18 @@ public class ScadaServiceImpl implements IScadaService
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public int deleteScadaByIds(Long[] ids)
|
||||
{
|
||||
for(Long id:ids){
|
||||
Scada scada = scadaMapper.selectScadaById(id);
|
||||
if(ScadaTypeEnum.SCENE_MODEL.getType().equals(scada.getType())){
|
||||
scadaMapper.resetDeviceGuid(scada.getGuid());
|
||||
}else{
|
||||
scadaMapper.resetProductGuid(scada.getGuid());
|
||||
}
|
||||
scadaDeviceBindMapper.deleteScadaDeviceBindByGuid(scada.getGuid());
|
||||
}
|
||||
return scadaMapper.deleteScadaByIds(ids);
|
||||
}
|
||||
|
||||
|
||||
@@ -90,6 +90,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
delete from scada_device_bind where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteScadaDeviceBindByGuid" parameterType="java.lang.String">
|
||||
delete from scada_device_bind where scada_guid = #{scadaGuid}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteScadaDeviceBindByIds" parameterType="String">
|
||||
delete from scada_device_bind where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
|
||||
@@ -339,6 +339,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
and del_flag = '0'
|
||||
</select>
|
||||
|
||||
<select id="selectDeptIdBySn" resultType="java.lang.Long">
|
||||
select agencies_id
|
||||
from iot_device
|
||||
where serial_number = #{serial_number}
|
||||
and del_flag = '0'
|
||||
</select>
|
||||
|
||||
<select id="selectSceneModelByGuid" resultType="java.lang.Long">
|
||||
select scene_model_id
|
||||
from scene_model
|
||||
@@ -351,7 +358,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
set guid = #{guid}
|
||||
where product_id = #{productId}
|
||||
</update>
|
||||
|
||||
<update id="resetProductGuid">
|
||||
UPDATE iot_product
|
||||
SET guid = NULL
|
||||
WHERE guid =#{guid}
|
||||
</update>
|
||||
<update id="updateSceneModelGuid">
|
||||
update scene_model
|
||||
set guid = #{guid}
|
||||
@@ -363,6 +374,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
set guid = #{guid,jdbcType=VARCHAR}
|
||||
where serial_number = #{serialNumber,jdbcType=VARCHAR}
|
||||
</update>
|
||||
<update id="resetDeviceGuid">
|
||||
update iot_device
|
||||
set guid = NULL
|
||||
where guid = #{guid,jdbcType=VARCHAR}
|
||||
</update>
|
||||
|
||||
<update id="deleteSceneModelByGuids">
|
||||
update scene_model
|
||||
|
||||
Reference in New Issue
Block a user