上传文件至 'op-modules/op-quality/src/main/java/com/op/quality'
parent
73aca5b45b
commit
46e476cc33
@ -0,0 +1,123 @@
|
||||
package com.op.quality.domain;
|
||||
|
||||
import com.op.common.core.annotation.Excel;
|
||||
import com.op.common.core.web.domain.BaseEntity;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
/**
|
||||
* 附件对象 base_file
|
||||
*
|
||||
* @author Open Platform
|
||||
* @date 2023-07-10
|
||||
*/
|
||||
public class BaseFile extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 附件ID */
|
||||
private String fileId;
|
||||
|
||||
/** 附件名称 */
|
||||
@Excel(name = "附件名称")
|
||||
private String fileName;
|
||||
|
||||
/** 附件地址 */
|
||||
@Excel(name = "附件地址")
|
||||
private String fileAddress;
|
||||
|
||||
/** 数据来源 */
|
||||
@Excel(name = "数据来源")
|
||||
private String sourceId;
|
||||
|
||||
/** 预留字段1 */
|
||||
@Excel(name = "预留字段1")
|
||||
private String attr1;
|
||||
|
||||
/** 预留字段2 */
|
||||
@Excel(name = "预留字段2")
|
||||
private String attr2;
|
||||
|
||||
/** 预留字段3 */
|
||||
@Excel(name = "预留字段3")
|
||||
private Long attr3;
|
||||
|
||||
/** 预留字段4 */
|
||||
@Excel(name = "预留字段4")
|
||||
private Long attr4;
|
||||
|
||||
public void setFileId(String fileId) {
|
||||
this.fileId = fileId;
|
||||
}
|
||||
|
||||
public String getFileId() {
|
||||
return fileId;
|
||||
}
|
||||
public void setFileName(String fileName) {
|
||||
this.fileName = fileName;
|
||||
}
|
||||
|
||||
public String getFileName() {
|
||||
return fileName;
|
||||
}
|
||||
public void setFileAddress(String fileAddress) {
|
||||
this.fileAddress = fileAddress;
|
||||
}
|
||||
|
||||
public String getFileAddress() {
|
||||
return fileAddress;
|
||||
}
|
||||
public void setSourceId(String sourceId) {
|
||||
this.sourceId = sourceId;
|
||||
}
|
||||
|
||||
public String getSourceId() {
|
||||
return sourceId;
|
||||
}
|
||||
public void setAttr1(String attr1) {
|
||||
this.attr1 = attr1;
|
||||
}
|
||||
|
||||
public String getAttr1() {
|
||||
return attr1;
|
||||
}
|
||||
public void setAttr2(String attr2) {
|
||||
this.attr2 = attr2;
|
||||
}
|
||||
|
||||
public String getAttr2() {
|
||||
return attr2;
|
||||
}
|
||||
public void setAttr3(Long attr3) {
|
||||
this.attr3 = attr3;
|
||||
}
|
||||
|
||||
public Long getAttr3() {
|
||||
return attr3;
|
||||
}
|
||||
public void setAttr4(Long attr4) {
|
||||
this.attr4 = attr4;
|
||||
}
|
||||
|
||||
public Long getAttr4() {
|
||||
return attr4;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("fileId", getFileId())
|
||||
.append("fileName", getFileName())
|
||||
.append("fileAddress", getFileAddress())
|
||||
.append("sourceId", getSourceId())
|
||||
.append("remark", getRemark())
|
||||
.append("attr1", getAttr1())
|
||||
.append("attr2", getAttr2())
|
||||
.append("attr3", getAttr3())
|
||||
.append("attr4", getAttr4())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.toString();
|
||||
}
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
package com.op.quality.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);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,333 @@
|
||||
package com.op.quality.domain;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.op.common.core.annotation.Excel;
|
||||
import com.op.common.core.web.domain.BaseEntity;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @ClassName : qua
|
||||
* @Description :
|
||||
* @Author :
|
||||
* @Date: 2023-08-17 10:18
|
||||
*/
|
||||
public class QcProCheck extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
@Excel(name = "id")
|
||||
private String id;
|
||||
|
||||
@Excel(name = "rfid")
|
||||
private String rfid;
|
||||
@Excel(name = "工厂id")
|
||||
private String factoryId;
|
||||
@Excel(name = "工厂编码")
|
||||
private String factoryCode;
|
||||
|
||||
@Excel(name = "工单id")
|
||||
private String workorderId;
|
||||
@Excel(name = "工厂编码")
|
||||
private String workorderCode;
|
||||
@Excel(name = "工厂名称")
|
||||
private String workorderName;
|
||||
|
||||
@Excel(name = "订单id")
|
||||
private String orderId;
|
||||
@Excel(name = "订单编码")
|
||||
private String orderCode;
|
||||
|
||||
@Excel(name = "机台id")
|
||||
private String machineId;
|
||||
@Excel(name = "机台编码")
|
||||
private String machineCode;
|
||||
|
||||
@Excel(name = "不良描述")
|
||||
private String badMeg;
|
||||
|
||||
@Excel(name = "产品id")
|
||||
private String productId;
|
||||
|
||||
private String productCode;
|
||||
@Excel(name = "是否合格")
|
||||
private String isqua;
|
||||
|
||||
@Excel(name = "附件")
|
||||
private String fileId;
|
||||
|
||||
@Excel(name = "创建者")
|
||||
private String createBy;
|
||||
/** 创建时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
@Excel(name = "更新者")
|
||||
private String updateBy;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date updateTime;
|
||||
|
||||
private String attr1;
|
||||
private String attr2;
|
||||
private String attr3;
|
||||
private String attr4;
|
||||
|
||||
public String getFactoryId() {
|
||||
return factoryId;
|
||||
}
|
||||
|
||||
public void setFactoryId(String factoryId) {
|
||||
this.factoryId = factoryId;
|
||||
}
|
||||
|
||||
public String getFactoryCode() {
|
||||
return factoryCode;
|
||||
}
|
||||
|
||||
public void setFactoryCode(String factoryCode) {
|
||||
this.factoryCode = factoryCode;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getRfid() {
|
||||
return rfid;
|
||||
}
|
||||
|
||||
public void setRfid(String rfid) {
|
||||
this.rfid = rfid;
|
||||
}
|
||||
|
||||
public String getWorkorderId() {
|
||||
return workorderId;
|
||||
}
|
||||
|
||||
public void setWorkorderId(String workorderId) {
|
||||
this.workorderId = workorderId;
|
||||
}
|
||||
|
||||
public String getWorkorderCode() {
|
||||
return workorderCode;
|
||||
}
|
||||
|
||||
public void setWorkorderCode(String workorderCode) {
|
||||
this.workorderCode = workorderCode;
|
||||
}
|
||||
|
||||
public String getWorkorderName() {
|
||||
return workorderName;
|
||||
}
|
||||
|
||||
public void setWorkorderName(String workorderName) {
|
||||
this.workorderName = workorderName;
|
||||
}
|
||||
|
||||
public String getOrderId() {
|
||||
return orderId;
|
||||
}
|
||||
|
||||
public void setOrderId(String orderId) {
|
||||
this.orderId = orderId;
|
||||
}
|
||||
|
||||
public String getOrderCode() {
|
||||
return orderCode;
|
||||
}
|
||||
|
||||
public void setOrderCode(String orderCode) {
|
||||
this.orderCode = orderCode;
|
||||
}
|
||||
|
||||
public String getMachineId() {
|
||||
return machineId;
|
||||
}
|
||||
|
||||
public void setMachineId(String machineId) {
|
||||
this.machineId = machineId;
|
||||
}
|
||||
|
||||
public String getMachineCode() {
|
||||
return machineCode;
|
||||
}
|
||||
|
||||
public void setMachineCode(String machineCode) {
|
||||
this.machineCode = machineCode;
|
||||
}
|
||||
|
||||
public String getBadMeg() {
|
||||
return badMeg;
|
||||
}
|
||||
|
||||
public void setBadMeg(String badMeg) {
|
||||
this.badMeg = badMeg;
|
||||
}
|
||||
|
||||
public String getProductId() {
|
||||
return productId;
|
||||
}
|
||||
|
||||
public void setProductId(String productId) {
|
||||
this.productId = productId;
|
||||
}
|
||||
|
||||
public String getProductCode() {
|
||||
return productCode;
|
||||
}
|
||||
|
||||
public void setProductCode(String productCode) {
|
||||
this.productCode = productCode;
|
||||
}
|
||||
|
||||
public String getIsqua() {
|
||||
return isqua;
|
||||
}
|
||||
|
||||
public void setIsqua(String isqua) {
|
||||
this.isqua = isqua;
|
||||
}
|
||||
|
||||
public String getFileId() {
|
||||
return fileId;
|
||||
}
|
||||
|
||||
public void setFileId(String fileId) {
|
||||
this.fileId = fileId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCreateBy() {
|
||||
return createBy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCreateBy(String createBy) {
|
||||
this.createBy = createBy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUpdateBy() {
|
||||
return updateBy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setUpdateBy(String updateBy) {
|
||||
this.updateBy = updateBy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Date getUpdateTime() {
|
||||
return updateTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setUpdateTime(Date updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
|
||||
public String getAttr1() {
|
||||
return attr1;
|
||||
}
|
||||
|
||||
public void setAttr1(String attr1) {
|
||||
this.attr1 = attr1;
|
||||
}
|
||||
|
||||
public String getAttr2() {
|
||||
return attr2;
|
||||
}
|
||||
|
||||
public void setAttr2(String attr2) {
|
||||
this.attr2 = attr2;
|
||||
}
|
||||
|
||||
public String getAttr3() {
|
||||
return attr3;
|
||||
}
|
||||
|
||||
public void setAttr3(String attr3) {
|
||||
this.attr3 = attr3;
|
||||
}
|
||||
|
||||
public String getAttr4() {
|
||||
return attr4;
|
||||
}
|
||||
|
||||
public void setAttr4(String attr4) {
|
||||
this.attr4 = attr4;
|
||||
}
|
||||
|
||||
public QcProCheck(String id, String rfid, String factoryId, String factoryCode, String workorderId, String workorderCode, String workorderName, String orderId, String orderCode, String machineId, String machineCode, String badMeg, String productId, String productCode, String isqua, String fileId, String createBy, Date createTime, String updateBy, Date updateTime, String attr1, String attr2, String attr3, String attr4) {
|
||||
this.id = id;
|
||||
this.rfid = rfid;
|
||||
this.factoryId = factoryId;
|
||||
this.factoryCode = factoryCode;
|
||||
this.workorderId = workorderId;
|
||||
this.workorderCode = workorderCode;
|
||||
this.workorderName = workorderName;
|
||||
this.orderId = orderId;
|
||||
this.orderCode = orderCode;
|
||||
this.machineId = machineId;
|
||||
this.machineCode = machineCode;
|
||||
this.badMeg = badMeg;
|
||||
this.productId = productId;
|
||||
this.productCode = productCode;
|
||||
this.isqua = isqua;
|
||||
this.fileId = fileId;
|
||||
this.createBy = createBy;
|
||||
this.createTime = createTime;
|
||||
this.updateBy = updateBy;
|
||||
this.updateTime = updateTime;
|
||||
this.attr1 = attr1;
|
||||
this.attr2 = attr2;
|
||||
this.attr3 = attr3;
|
||||
this.attr4 = attr4;
|
||||
}
|
||||
|
||||
public QcProCheck() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "QcProCheck{" +
|
||||
"id='" + id + '\'' +
|
||||
", rfid='" + rfid + '\'' +
|
||||
", factoryId='" + factoryId + '\'' +
|
||||
", factoryCode='" + factoryCode + '\'' +
|
||||
", workorderId='" + workorderId + '\'' +
|
||||
", workorderCode='" + workorderCode + '\'' +
|
||||
", workorderName='" + workorderName + '\'' +
|
||||
", orderId='" + orderId + '\'' +
|
||||
", orderCode='" + orderCode + '\'' +
|
||||
", machineId='" + machineId + '\'' +
|
||||
", machineCode='" + machineCode + '\'' +
|
||||
", badMeg='" + badMeg + '\'' +
|
||||
", productId='" + productId + '\'' +
|
||||
", productCode='" + productCode + '\'' +
|
||||
", isqua='" + isqua + '\'' +
|
||||
", fileId='" + fileId + '\'' +
|
||||
", createBy='" + createBy + '\'' +
|
||||
", createTime=" + createTime +
|
||||
", updateBy='" + updateBy + '\'' +
|
||||
", updateTime=" + updateTime +
|
||||
", attr1='" + attr1 + '\'' +
|
||||
", attr2='" + attr2 + '\'' +
|
||||
", attr3='" + attr3 + '\'' +
|
||||
", attr4='" + attr4 + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
@ -0,0 +1,78 @@
|
||||
package com.op.quality.Controller;
|
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.op.common.core.domain.R;
|
||||
import com.op.common.core.utils.uuid.UUID;
|
||||
import com.op.quality.domain.BaseFile;
|
||||
import com.op.quality.domain.QcProCheck;
|
||||
import com.op.quality.service.QcProCheckService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @ClassName : quaController
|
||||
* @Description :
|
||||
* @Author :
|
||||
* @Date: 2023-08-17 10:28
|
||||
*/
|
||||
@RestController
|
||||
public class QuaController {
|
||||
@Autowired
|
||||
private QcProCheckService qcProCheckService;
|
||||
|
||||
|
||||
@PostMapping("/saveQcProCheck")
|
||||
public R<Boolean> saveQcProCheck(@RequestBody Map<QcProCheck,BaseFile> map) {
|
||||
// System.out.println(qcProCheck);
|
||||
// System.out.println(baseFile);
|
||||
QcProCheck qcProCheck = map.keySet().iterator().next();
|
||||
BaseFile baseFile = map.values().iterator().next();
|
||||
|
||||
if (!qcProCheck.getFactoryId().isEmpty()){
|
||||
if (baseFile==null){
|
||||
baseFile = new BaseFile();
|
||||
qcProCheckService.saveQcProCheck(qcProCheck,baseFile);
|
||||
}
|
||||
|
||||
if (qcProCheck.getIsqua()=="1"){
|
||||
System.out.println("调用下一个接口");
|
||||
return R.ok();
|
||||
}
|
||||
else{
|
||||
return R.ok();
|
||||
}
|
||||
}
|
||||
return R.fail();
|
||||
}
|
||||
@PostMapping("/test")
|
||||
public R<Boolean> test() {
|
||||
// System.out.println(qcProCheck);
|
||||
// System.out.println(baseFile);
|
||||
// QcProCheck qcProCheck = map.keySet().iterator().next();
|
||||
// BaseFile baseFile = map.values().iterator().next();
|
||||
QcProCheck qcProCheck = new QcProCheck();
|
||||
BaseFile baseFile = new BaseFile();
|
||||
qcProCheck.setId("1232132132121321");
|
||||
qcProCheck.setFactoryId("qewqewqewq");
|
||||
qcProCheck.setIsqua("1");
|
||||
baseFile.setFileAddress("qwewqewqewqewqewqq");
|
||||
if (!qcProCheck.getFactoryId().isEmpty()){
|
||||
if (baseFile==null){
|
||||
baseFile = new BaseFile();
|
||||
qcProCheckService.saveQcProCheck(qcProCheck,baseFile);
|
||||
}
|
||||
|
||||
if (qcProCheck.getIsqua()=="1"){
|
||||
System.out.println("调用下一个接口");
|
||||
return R.ok();
|
||||
}
|
||||
else{
|
||||
return R.ok();
|
||||
}
|
||||
}
|
||||
return R.fail();
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue