Merge remote-tracking branch 'origin/master'
commit
a165813130
@ -0,0 +1,53 @@
|
||||
package com.op.device.config;
|
||||
|
||||
import com.baomidou.dynamic.datasource.spring.boot.autoconfigure.DataSourceProperty;
|
||||
import com.op.common.core.domain.R;
|
||||
import com.op.common.datasource.creator.DynamicDatasourceCreator;
|
||||
import com.op.system.api.RemoteUserService;
|
||||
import com.op.system.api.domain.SysUser;
|
||||
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 初始化动态数据源
|
||||
*
|
||||
* @ClassName: DynamicDatasource
|
||||
* @Description: TODO
|
||||
* @author shichangzhou
|
||||
* @date 2023年4月19日 下午1:01:30
|
||||
*/
|
||||
@Component
|
||||
public class DynamicDatasource {
|
||||
|
||||
@Resource
|
||||
private DynamicDatasourceCreator dynamicDatasourceCreator;
|
||||
@Autowired
|
||||
private RemoteUserService remoteUserService;
|
||||
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
// 加载sf-cloud库的sys_datasource
|
||||
SysUser sysUser = new SysUser();
|
||||
sysUser.setUserId(1L);
|
||||
R<List<Map<String, String>>> dateSources0 = remoteUserService.getPoolNameList(sysUser);
|
||||
List<Map<String, String>> dateSources = dateSources0.getData();
|
||||
for (Map<String, String> dateSource : dateSources) {
|
||||
DataSourceProperty sdp = new DataSourceProperty();
|
||||
sdp.setUrl(dateSource.get("url"));
|
||||
sdp.setUsername(dateSource.get("userName"));
|
||||
sdp.setPassword(dateSource.get("password"));
|
||||
sdp.setDriverClassName(dateSource.get("driveClassName"));
|
||||
sdp.setPoolName(dateSource.get("poolName"));// 这是数据源的key
|
||||
sdp.setLazy(false);
|
||||
dynamicDatasourceCreator.createDynamicDataSource(sdp);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -1,89 +1,153 @@
|
||||
package com.op.device.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.op.common.core.context.SecurityContextHolder;
|
||||
import com.op.common.core.utils.DateUtils;
|
||||
import com.op.common.core.utils.uuid.IdUtils;
|
||||
import com.op.common.core.web.domain.AjaxResult;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.op.device.mapper.EquFaultTypeMapper;
|
||||
import com.op.device.domain.EquFaultType;
|
||||
import com.op.device.service.IEquFaultTypeService;
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import static com.op.common.core.web.domain.AjaxResult.error;
|
||||
import static com.op.common.core.web.domain.AjaxResult.success;
|
||||
|
||||
/**
|
||||
* 故障类型维护Service业务层处理
|
||||
*
|
||||
*
|
||||
* @author wws
|
||||
* @date 2023-10-12
|
||||
*/
|
||||
@Service
|
||||
public class EquFaultTypeServiceImpl implements IEquFaultTypeService {
|
||||
@Autowired
|
||||
private EquFaultTypeMapper equFaultTypeMapper;
|
||||
|
||||
/**
|
||||
* 查询故障类型维护
|
||||
*
|
||||
* @param faultId 故障类型维护主键
|
||||
* @return 故障类型维护
|
||||
*/
|
||||
@Override
|
||||
public EquFaultType selectEquFaultTypeByFaultId(String faultId) {
|
||||
return equFaultTypeMapper.selectEquFaultTypeByFaultId(faultId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询故障类型维护列表
|
||||
*
|
||||
* @param equFaultType 故障类型维护
|
||||
* @return 故障类型维护
|
||||
*/
|
||||
@Override
|
||||
public List<EquFaultType> selectEquFaultTypeList(EquFaultType equFaultType) {
|
||||
return equFaultTypeMapper.selectEquFaultTypeList(equFaultType);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增故障类型维护
|
||||
*
|
||||
* @param equFaultType 故障类型维护
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertEquFaultType(EquFaultType equFaultType) {
|
||||
equFaultType.setCreateTime(DateUtils.getNowDate());
|
||||
return equFaultTypeMapper.insertEquFaultType(equFaultType);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改故障类型维护
|
||||
*
|
||||
* @param equFaultType 故障类型维护
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateEquFaultType(EquFaultType equFaultType) {
|
||||
equFaultType.setUpdateTime(DateUtils.getNowDate());
|
||||
return equFaultTypeMapper.updateEquFaultType(equFaultType);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除故障类型维护
|
||||
*
|
||||
* @param faultIds 需要删除的故障类型维护主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteEquFaultTypeByFaultIds(String[] faultIds) {
|
||||
return equFaultTypeMapper.deleteEquFaultTypeByFaultIds(faultIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除故障类型维护信息
|
||||
*
|
||||
* @param faultId 故障类型维护主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteEquFaultTypeByFaultId(String faultId) {
|
||||
return equFaultTypeMapper.deleteEquFaultTypeByFaultId(faultId);
|
||||
}
|
||||
@Autowired
|
||||
private EquFaultTypeMapper equFaultTypeMapper;
|
||||
|
||||
/**
|
||||
* 查询故障类型维护
|
||||
*
|
||||
* @param faultId 故障类型维护主键
|
||||
* @return 故障类型维护
|
||||
*/
|
||||
@Override
|
||||
@DS("#header.poolName")
|
||||
public EquFaultType selectEquFaultTypeByFaultId(String faultId) {
|
||||
return equFaultTypeMapper.selectEquFaultTypeByFaultId(faultId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询故障类型维护列表
|
||||
*
|
||||
* @param equFaultType 故障类型维护
|
||||
* @return 故障类型维护
|
||||
*/
|
||||
@Override
|
||||
@DS("#header.poolName")
|
||||
public List<EquFaultType> selectEquFaultTypeList(EquFaultType equFaultType) {
|
||||
return equFaultTypeMapper.selectEquFaultTypeList(equFaultType);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增故障类型维护
|
||||
*
|
||||
* @param equFaultType 故障类型维护
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@DS("#header.poolName")
|
||||
public AjaxResult insertEquFaultType(EquFaultType equFaultType) {
|
||||
|
||||
// 检验
|
||||
EquFaultType checkQuery = new EquFaultType();
|
||||
checkQuery.setFaultType(equFaultType.getFaultType());
|
||||
checkQuery.setFaultSubclass(equFaultType.getFaultSubclass());
|
||||
List<EquFaultType> check = equFaultTypeMapper.selectEquFaultTypeList(checkQuery);
|
||||
if (check.size() > 0) {
|
||||
return error(500,"故障子类已存在!不可添加!");
|
||||
}
|
||||
|
||||
//获取当前所选工厂
|
||||
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
|
||||
String key = "#header.poolName";
|
||||
String str = request.getHeader(key.substring(8));
|
||||
int index = str.indexOf("_");
|
||||
String factory = str.substring(index + 1);
|
||||
|
||||
// 获取检查项流水号
|
||||
String serialNum = String.format("%03d", equFaultTypeMapper.selectSerialNumber());
|
||||
|
||||
// 处理故障信息
|
||||
equFaultType.setFaultId(IdUtils.fastSimpleUUID());
|
||||
equFaultType.setFaultCode(DateUtils.dateTimeNow(DateUtils.YYYYMMDD) + serialNum);
|
||||
equFaultType.setFactoryCode(factory);
|
||||
equFaultType.setCreateBy(SecurityContextHolder.getUserName());
|
||||
equFaultType.setCreateTime(DateUtils.getNowDate());
|
||||
equFaultType.setUpdateBy(SecurityContextHolder.getUserName());
|
||||
equFaultType.setUpdateTime(DateUtils.getNowDate());
|
||||
|
||||
// 插入数据库
|
||||
equFaultTypeMapper.insertEquFaultType(equFaultType);
|
||||
|
||||
return success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改故障类型维护
|
||||
*
|
||||
* @param equFaultType 故障类型维护
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@DS("#header.poolName")
|
||||
public AjaxResult updateEquFaultType(EquFaultType equFaultType) {
|
||||
|
||||
// 检验
|
||||
EquFaultType checkQuery = new EquFaultType();
|
||||
checkQuery.setFaultType(equFaultType.getFaultType());
|
||||
checkQuery.setFaultSubclass(equFaultType.getFaultSubclass());
|
||||
List<EquFaultType> check = equFaultTypeMapper.selectEquFaultTypeList(checkQuery);
|
||||
if (check.size() > 0) {
|
||||
if (!check.get(0).equals(equFaultType.getFaultCode())) {
|
||||
return error(500,"故障子类已存在!修改失败!");
|
||||
}
|
||||
}
|
||||
equFaultType.setUpdateBy(SecurityContextHolder.getUserName());
|
||||
equFaultType.setUpdateTime(DateUtils.getNowDate());
|
||||
// 插入数据库
|
||||
equFaultTypeMapper.updateEquFaultType(equFaultType);
|
||||
|
||||
return success("修改成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除故障类型维护
|
||||
*
|
||||
* @param faultIds 需要删除的故障类型维护主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@DS("#header.poolName")
|
||||
public int deleteEquFaultTypeByFaultIds(String[] faultIds) {
|
||||
return equFaultTypeMapper.deleteEquFaultTypeByFaultIds(faultIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除故障类型维护信息
|
||||
*
|
||||
* @param faultId 故障类型维护主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@DS("#header.poolName")
|
||||
public int deleteEquFaultTypeByFaultId(String faultId) {
|
||||
return equFaultTypeMapper.deleteEquFaultTypeByFaultId(faultId);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,143 @@
|
||||
package com.op.mes.domain;
|
||||
|
||||
import com.op.common.core.web.domain.BaseEntity;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 小时产量
|
||||
*
|
||||
* @author Open Platform
|
||||
* @date 2023-08-24
|
||||
*/
|
||||
public class MesHourReport extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private String productCode;//产品编码
|
||||
private String productName;//产品名称
|
||||
private String quantity;//数量
|
||||
private String unit;//单位
|
||||
private String hourName;
|
||||
private String productDateStart;
|
||||
private String productDateEnd;
|
||||
private String ymdh;
|
||||
private String equCode;
|
||||
private String equName;
|
||||
private String orderCode;
|
||||
private String workorderCode;
|
||||
private List<String> hourNames;
|
||||
private String equCodeHour;
|
||||
|
||||
public String getEquCodeHour() {
|
||||
return equCodeHour;
|
||||
}
|
||||
|
||||
public void setEquCodeHour(String equCodeHour) {
|
||||
this.equCodeHour = equCodeHour;
|
||||
}
|
||||
|
||||
public List<String> getHourNames() {
|
||||
return hourNames;
|
||||
}
|
||||
|
||||
public void setHourNames(List<String> hourNames) {
|
||||
this.hourNames = hourNames;
|
||||
}
|
||||
|
||||
public String getOrderCode() {
|
||||
return orderCode;
|
||||
}
|
||||
|
||||
public void setOrderCode(String orderCode) {
|
||||
this.orderCode = orderCode;
|
||||
}
|
||||
|
||||
public String getWorkorderCode() {
|
||||
return workorderCode;
|
||||
}
|
||||
|
||||
public void setWorkorderCode(String workorderCode) {
|
||||
this.workorderCode = workorderCode;
|
||||
}
|
||||
|
||||
public String getYmdh() {
|
||||
return ymdh;
|
||||
}
|
||||
|
||||
public void setYmdh(String ymdh) {
|
||||
this.ymdh = ymdh;
|
||||
}
|
||||
|
||||
public String getEquCode() {
|
||||
return equCode;
|
||||
}
|
||||
|
||||
public void setEquCode(String equCode) {
|
||||
this.equCode = equCode;
|
||||
}
|
||||
|
||||
public String getEquName() {
|
||||
return equName;
|
||||
}
|
||||
|
||||
public void setEquName(String equName) {
|
||||
this.equName = equName;
|
||||
}
|
||||
|
||||
public String getProductDateStart() {
|
||||
return productDateStart;
|
||||
}
|
||||
|
||||
public void setProductDateStart(String productDateStart) {
|
||||
this.productDateStart = productDateStart;
|
||||
}
|
||||
|
||||
public String getProductDateEnd() {
|
||||
return productDateEnd;
|
||||
}
|
||||
|
||||
public void setProductDateEnd(String productDateEnd) {
|
||||
this.productDateEnd = productDateEnd;
|
||||
}
|
||||
|
||||
public String getProductCode() {
|
||||
return productCode;
|
||||
}
|
||||
|
||||
public void setProductCode(String productCode) {
|
||||
this.productCode = productCode;
|
||||
}
|
||||
|
||||
public String getProductName() {
|
||||
return productName;
|
||||
}
|
||||
|
||||
public void setProductName(String productName) {
|
||||
this.productName = productName;
|
||||
}
|
||||
|
||||
public String getQuantity() {
|
||||
return quantity;
|
||||
}
|
||||
|
||||
public void setQuantity(String quantity) {
|
||||
this.quantity = quantity;
|
||||
}
|
||||
|
||||
public String getUnit() {
|
||||
return unit;
|
||||
}
|
||||
|
||||
public void setUnit(String unit) {
|
||||
this.unit = unit;
|
||||
}
|
||||
|
||||
public String getHourName() {
|
||||
return hourName;
|
||||
}
|
||||
|
||||
public void setHourName(String hourName) {
|
||||
this.hourName = hourName;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue