diff
This commit is contained in:
@ -69,10 +69,6 @@ public class FacilitiesCardController {
|
||||
* 获取左侧树形数据 设施、管道通用
|
||||
* @param request
|
||||
* @param model
|
||||
* @param page
|
||||
* @param rows
|
||||
* @param sort
|
||||
* @param order
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/getTreeJson.do")
|
||||
|
||||
@ -4,6 +4,7 @@ import com.serotonin.modbus4j.sero.util.queue.ByteQueue;
|
||||
import com.sipai.controller.work.ReadAWriteUtil;
|
||||
import com.sipai.dao.repository.MPointRepo;
|
||||
import com.sipai.dao.scada.MPointDao;
|
||||
import com.sipai.entity.base.Result;
|
||||
import com.sipai.entity.enums.EnableTypeEnum;
|
||||
import com.sipai.entity.enums.SourceTypeEnum;
|
||||
import com.sipai.entity.scada.*;
|
||||
@ -79,6 +80,8 @@ public class MPointService {
|
||||
@Autowired
|
||||
private CompanyService companyService;
|
||||
@Resource
|
||||
private MPointExpandService mPointExpandService;
|
||||
@Resource
|
||||
private UnitService unitService;
|
||||
|
||||
public MPoint selectById(String bizId, String id) {
|
||||
@ -165,7 +168,7 @@ public class MPointService {
|
||||
return res;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
// @Transactional
|
||||
public int save(String bizId, MPoint entity) {
|
||||
int res = 0;
|
||||
try {
|
||||
@ -679,7 +682,7 @@ public class MPointService {
|
||||
|
||||
}
|
||||
}
|
||||
if(mPoint.getBizid()!=null && !mPoint.getBizid().isEmpty()){
|
||||
if (mPoint.getBizid() != null && !mPoint.getBizid().isEmpty()) {
|
||||
Unit unit = this.unitService.getUnitById(mPoint.getBizid());
|
||||
if (unit != null) {
|
||||
String unitName = unit.getSname();
|
||||
@ -1273,9 +1276,17 @@ public class MPointService {
|
||||
if (mPoint != null) {
|
||||
if (flag != null && flag.equals("insert")) {
|
||||
insertNum += this.mPointDao.insert(mPoint);
|
||||
try {
|
||||
//更新es
|
||||
MPointES mPointES = MPointES.format(mPoint);
|
||||
mPointRepo.save(mPointES);
|
||||
} catch (Exception e) {
|
||||
System.out.println("mPoint_save------------------" + e.getMessage());
|
||||
}
|
||||
}
|
||||
if (flag != null && flag.equals("update")) {
|
||||
updateNum += this.mPointDao.updateByPrimaryKeySelective(mPoint);
|
||||
// updateNum += this.mPointDao.updateByPrimaryKeySelective(mPoint);
|
||||
int result = this.update(mPoint.getBizid(), mPoint);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1643,6 +1654,7 @@ public class MPointService {
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* xls表格导入
|
||||
*
|
||||
@ -1668,15 +1680,15 @@ public class MPointService {
|
||||
for (int i = minCellNum; i < maxCellNum; i++) {
|
||||
HSSFCell mpidCell = mpidRow.getCell(i);
|
||||
String mpidStr = getStringVal(mpidCell);
|
||||
MPoint mPoint = this.selectByWhere(unitId,"where MPointCode like '%"+mpidStr+"%' or ParmName like '%"+mpidStr+"%' ");
|
||||
if(mPoint!=null){
|
||||
MPoint mPoint = this.selectByWhere(unitId, "where MPointCode like '%" + mpidStr + "%' or ParmName like '%" + mpidStr + "%' ");
|
||||
if (mPoint != null) {
|
||||
String mpid = mPoint.getMpointcode();
|
||||
MPointHistory mPointHistory = new MPointHistory();
|
||||
boolean st = true;
|
||||
List<MPointHistory> mPointHistorys = mPointHistoryService.selectListByTableAWhere(unitId,"[TB_MP_" + mpid + "]",
|
||||
"where MeasureDT='"+measuredt+"' order by MeasureDT ");
|
||||
if(mPointHistorys!=null && mPointHistorys.size()>0){
|
||||
mPointHistory= mPointHistorys.get(0);
|
||||
List<MPointHistory> mPointHistorys = mPointHistoryService.selectListByTableAWhere(unitId, "[TB_MP_" + mpid + "]",
|
||||
"where MeasureDT='" + measuredt + "' order by MeasureDT ");
|
||||
if (mPointHistorys != null && mPointHistorys.size() > 0) {
|
||||
mPointHistory = mPointHistorys.get(0);
|
||||
st = false;
|
||||
}
|
||||
mPointHistory.setTbName("[TB_MP_" + mpid + "]");
|
||||
@ -1686,9 +1698,9 @@ public class MPointService {
|
||||
BigDecimal value = new BigDecimal(parmValue);
|
||||
mPointHistory.setParmvalue(value);
|
||||
if (mPointHistory != null) {
|
||||
if(st){
|
||||
if (st) {
|
||||
insertNum += mPointHistoryService.save(unitId, mPointHistory);
|
||||
}else{
|
||||
} else {
|
||||
insertNum += mPointHistoryService.updateByMeasureDt(unitId, mPointHistory);
|
||||
}
|
||||
}
|
||||
@ -1728,15 +1740,15 @@ public class MPointService {
|
||||
for (int i = minCellNum; i < maxCellNum; i++) {
|
||||
XSSFCell mpidCell = mpidRow.getCell(i);
|
||||
String mpidStr = getStringVal(mpidCell);
|
||||
MPoint mPoint = this.selectByWhere(unitId,"where MPointCode like '%"+mpidStr+"%' or ParmName like '%"+mpidStr+"%' ");
|
||||
if(mPoint!=null) {
|
||||
MPoint mPoint = this.selectByWhere(unitId, "where MPointCode like '%" + mpidStr + "%' or ParmName like '%" + mpidStr + "%' ");
|
||||
if (mPoint != null) {
|
||||
boolean st = true;
|
||||
String mpid = mPoint.getMpointcode();
|
||||
MPointHistory mPointHistory = new MPointHistory();
|
||||
List<MPointHistory> mPointHistorys = mPointHistoryService.selectListByTableAWhere(unitId,"[TB_MP_" + mpid + "]",
|
||||
"where MeasureDT='"+measuredt+"' order by MeasureDT ");
|
||||
if(mPointHistorys!=null && mPointHistorys.size()>0){
|
||||
mPointHistory= mPointHistorys.get(0);
|
||||
List<MPointHistory> mPointHistorys = mPointHistoryService.selectListByTableAWhere(unitId, "[TB_MP_" + mpid + "]",
|
||||
"where MeasureDT='" + measuredt + "' order by MeasureDT ");
|
||||
if (mPointHistorys != null && mPointHistorys.size() > 0) {
|
||||
mPointHistory = mPointHistorys.get(0);
|
||||
st = false;
|
||||
}
|
||||
mPointHistory.setTbName("[TB_MP_" + mpid + "]");
|
||||
@ -1746,9 +1758,9 @@ public class MPointService {
|
||||
BigDecimal value = new BigDecimal(parmValue);
|
||||
mPointHistory.setParmvalue(value);
|
||||
if (mPointHistory != null) {
|
||||
if(st){
|
||||
if (st) {
|
||||
insertNum += mPointHistoryService.save(unitId, mPointHistory);
|
||||
}else{
|
||||
} else {
|
||||
insertNum += mPointHistoryService.updateByMeasureDt(unitId, mPointHistory);
|
||||
}
|
||||
}
|
||||
|
||||
@ -10,28 +10,31 @@ public class DataSourceInterceptor {
|
||||
/* @Pointcut("execution(public * com.sipai.service.scada.*.*(..))")
|
||||
public void dataSourceScadaPointcut(){};*/
|
||||
|
||||
//@Before("dataSourceScadaPointcut()")
|
||||
public void before(JoinPoint jp) {
|
||||
Object[] argusObjects =jp.getArgs();
|
||||
|
||||
//若只有一个参数,则默认使用es
|
||||
//@Before("dataSourceScadaPointcut()")
|
||||
public void before(JoinPoint jp) {
|
||||
Object[] argusObjects = jp.getArgs();
|
||||
|
||||
//若只有一个参数,则默认使用es
|
||||
if (argusObjects == null || argusObjects.length < 2 || !(argusObjects[0] instanceof String)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Object argus=argusObjects[0];
|
||||
if(argus!=null){
|
||||
DataSourceHolder.setDataSources(DataSources.valueOf("SCADA_"+argus.toString()));
|
||||
}else{
|
||||
DataSourceHolder.setDataSources(DataSources.valueOf("SCADA_YL"));
|
||||
}
|
||||
|
||||
//适应所有生产库存集中为一个数据库
|
||||
Object argus = argusObjects[0];
|
||||
if (argus != null) {
|
||||
DataSourceHolder.setDataSources(DataSources.valueOf("SCADA_"+argus.toString()));
|
||||
// DataSourceHolder.setDataSources(DataSources.valueOf("SCADA_HFCG"));
|
||||
} else {
|
||||
// DataSourceHolder.setDataSources(DataSources.valueOf("SCADA_YL"));
|
||||
DataSourceHolder.setDataSources(DataSources.valueOf("SCADA_0533JS"));
|
||||
}
|
||||
|
||||
//适应所有生产库存集中为一个数据库
|
||||
// DataSourceHolder.setDataSources(DataSources.SCADA_0756ZH);
|
||||
}
|
||||
//@After("dataSourceScadaPointcut()")
|
||||
public void after(JoinPoint jp) {
|
||||
DataSourceHolder.reset();
|
||||
}
|
||||
// ... ...
|
||||
}
|
||||
|
||||
//@After("dataSourceScadaPointcut()")
|
||||
public void after(JoinPoint jp) {
|
||||
DataSourceHolder.reset();
|
||||
}
|
||||
// ... ...
|
||||
}
|
||||
|
||||
@ -29,7 +29,8 @@ public enum DataSources {
|
||||
//增城
|
||||
// MASTER, SCADA_020ZCYH, SCADA_020ZCZX, SCADA_020ZC, SCADA_fe6fe310097f4679b46b7a173578dd11,SCADA_f31c04e44c9548bdaeca9f54c9e982e2
|
||||
|
||||
MASTER, SCADA_HFCG
|
||||
// MASTER, SCADA_HFCG
|
||||
MASTER, SCADA_0533JS
|
||||
// MASTER, SCADA_FS_SK11_C
|
||||
// MASTER, SCADA_021HQWS
|
||||
// MASTER, SCADA_HFST
|
||||
|
||||
Reference in New Issue
Block a user