@ -0,0 +1,50 @@ | |||
/* | |||
* Author: DONGSK | |||
* Datetime: 2023/6/30 20:12 | |||
* Description: | |||
* History: | |||
* 作者姓名 --修改时间 --版本号--描述 | |||
*/ | |||
package com.digiwin.athena.app.infra.entity; | |||
import com.baomidou.mybatisplus.annotation.TableName; | |||
import com.digiwin.athena.opt.persistence.domain.BaseMgrEntity; | |||
import lombok.Data; | |||
import java.util.Date; | |||
/** | |||
* CpsQuestionInfo | |||
* | |||
* @author DONGSK 2023/6/30 20:12 | |||
* @since 1.0.0 | |||
*/ | |||
@Data | |||
@TableName(value = "cps_question_info", autoResultMap = true) | |||
public class CpsQuestionInfo extends BaseMgrEntity<CpsQuestionInfo> { | |||
private String defectType; | |||
private String questionLocation; | |||
private String questionArea; | |||
private Date questionTime; | |||
private String questionLevel; | |||
private String importanceLevel; | |||
private String timesOneDay; | |||
private String questionInformation; | |||
private String responsiblePerson; | |||
private String containmentMeasures; | |||
private String rootCauseIdentification; | |||
private String correctiveActions; | |||
private String effectVerification; | |||
private String controlStandards; | |||
private String completionTime; | |||
private Date controlArea; | |||
private String knowledgeAccumulation; | |||
private Integer status = 0; | |||
private Integer status1 = 0; | |||
private Integer status2 = 0; | |||
private Integer status3 = 0; | |||
private Integer status4 = 0; | |||
private Integer status5 = 0; | |||
private Integer status6 = 0; | |||
private String timestamp; | |||
} |
@ -1 +0,0 @@ | |||
package com.digiwin.athena.app.infra.entity; |
@ -1 +0,0 @@ | |||
package com.digiwin.athena.app.infra.mapper; |
@ -1,4 +0,0 @@ | |||
package com.digiwin.athena.app.infra; | |||
/* | |||
*1.基础服务放在此包下:主要是数据持久层,对外面提供基础数据处理 | |||
*/ |
@ -0,0 +1,20 @@ | |||
/* | |||
* Author: DONGSK | |||
* Datetime: 2023/6/30 20:18 | |||
* Description: | |||
* History: | |||
* 作者姓名 --修改时间 --版本号--描述 | |||
*/ | |||
package com.digiwin.athena.app.infra.repository; | |||
import com.digiwin.athena.app.infra.entity.CpsQuestionInfo; | |||
import com.digiwin.athena.opt.persistence.repository.BaseRepository; | |||
/** | |||
* CpsQuestionInfoRepository | |||
* | |||
* @author DONGSK 2023/6/30 20:18 | |||
* @since 1.0.0 | |||
*/ | |||
public interface CpsQuestionInfoRepository extends BaseRepository<CpsQuestionInfo> { | |||
} |
@ -1 +0,0 @@ | |||
package com.digiwin.athena.app.infra.repository; |
@ -0,0 +1,20 @@ | |||
/* | |||
* Author: DONGSK | |||
* Datetime: 2023/6/30 20:20 | |||
* Description: | |||
* History: | |||
* 作者姓名 --修改时间 --版本号--描述 | |||
*/ | |||
package com.digiwin.athena.app.infra.service; | |||
import com.digiwin.athena.app.infra.entity.CpsQuestionInfo; | |||
import com.digiwin.athena.opt.persistence.service.IBaseService; | |||
/** | |||
* CpsQuestionInfoService | |||
* | |||
* @author DONGSK 2023/6/30 20:20 | |||
* @since 1.0.0 | |||
*/ | |||
public interface CpsQuestionInfoService extends IBaseService<CpsQuestionInfo> { | |||
} |
@ -0,0 +1,22 @@ | |||
/* | |||
* Author: DONGSK | |||
* Datetime: 2023/6/30 20:21 | |||
* Description: | |||
* History: | |||
* 作者姓名 --修改时间 --版本号--描述 | |||
*/ | |||
package com.digiwin.athena.app.infra.service.Impl; | |||
import com.digiwin.athena.app.infra.entity.CpsQuestionInfo; | |||
import com.digiwin.athena.app.infra.repository.CpsQuestionInfoRepository; | |||
import com.digiwin.athena.app.infra.service.CpsQuestionInfoService; | |||
import com.digiwin.athena.opt.persistence.service.impl.AbsBaseService; | |||
/** | |||
* CpsQuestionInfoServiceImpl | |||
* | |||
* @author DONGSK 2023/6/30 20:21 | |||
* @since 1.0.0 | |||
*/ | |||
public class CpsQuestionInfoServiceImpl extends AbsBaseService<CpsQuestionInfoRepository, CpsQuestionInfo> implements CpsQuestionInfoService { | |||
} |
@ -0,0 +1,37 @@ | |||
/* | |||
* Author: DONGSK | |||
* Datetime: 2023/1/29 16:34 | |||
* Description: | |||
* History: | |||
* 作者姓名 --修改时间 --版本号--描述 | |||
*/ | |||
package com.digiwin.athena.app.provider; | |||
import com.digiwin.app.service.DWEAIResult; | |||
import com.digiwin.app.service.DWService; | |||
import com.digiwin.app.service.eai.EAIService; | |||
import com.digiwin.athena.app.service.cps.CpsUtil; | |||
import java.util.Map; | |||
/** | |||
* BasicEAIApiService | |||
* | |||
* @author DONGSK 2023/1/29 16:34 | |||
* @since 1.0.0 | |||
*/ | |||
public interface CpsEAIService extends DWService { | |||
@EAIService(id = CpsUtil.CPS_QUESTION_INFO_CREATE) | |||
DWEAIResult cpsQuestionCreate(Map<String, String> headers, String messageBody) throws Exception; | |||
@EAIService(id = CpsUtil.CPS_QUESTION_INFO_UPDATE) | |||
DWEAIResult cpsQuestionUpdate(Map<String, String> headers, String messageBody) throws Exception; | |||
@EAIService(id = CpsUtil.CPS_QUESTION_INFO_GET) | |||
DWEAIResult cpsQuestionGet(Map<String, String> headers, String messageBody) throws Exception; | |||
} |
@ -0,0 +1,42 @@ | |||
/* | |||
* Author: DONGSK | |||
* Datetime: 2023/6/30 19:51 | |||
* Description: | |||
* History: | |||
* 作者姓名 --修改时间 --版本号--描述 | |||
*/ | |||
package com.digiwin.athena.app.provider.impl; | |||
import com.digiwin.app.service.DWEAIResult; | |||
import com.digiwin.athena.app.provider.CpsEAIService; | |||
import com.digiwin.athena.app.service.cps.CpsUtil; | |||
import com.digiwin.athena.opt.common.eai.service.EAIServiceContext; | |||
import javax.annotation.Resource; | |||
import java.util.Map; | |||
/** | |||
* CpsEAIServiceImpl | |||
* | |||
* @author DONGSK 2023/6/30 19:51 | |||
* @since 1.0.0 | |||
*/ | |||
public class CpsEAIServiceImpl implements CpsEAIService { | |||
@Resource | |||
private EAIServiceContext eaiServiceContext; | |||
@Override | |||
public DWEAIResult cpsQuestionCreate(Map<String, String> headers, String messageBody) throws Exception { | |||
return eaiServiceContext.execute(CpsUtil.CPS_QUESTION_INFO_CREATE, headers, messageBody); | |||
} | |||
@Override | |||
public DWEAIResult cpsQuestionGet(Map<String, String> headers, String messageBody) throws Exception { | |||
return eaiServiceContext.execute(CpsUtil.CPS_QUESTION_INFO_GET, headers, messageBody); | |||
} | |||
@Override | |||
public DWEAIResult cpsQuestionUpdate(Map<String, String> headers, String messageBody) throws Exception { | |||
return eaiServiceContext.execute(CpsUtil.CPS_QUESTION_INFO_UPDATE, headers, messageBody); | |||
} | |||
} |
@ -0,0 +1,50 @@ | |||
/* | |||
* Author: DONGSK | |||
* Datetime: 2023/6/30 19:57 | |||
* Description: | |||
* History: | |||
* 作者姓名 --修改时间 --版本号--描述 | |||
*/ | |||
package com.digiwin.athena.app.service.cps; | |||
import com.alibaba.fastjson.TypeReference; | |||
import com.digiwin.app.service.DWEAIResult; | |||
import com.digiwin.athena.app.infra.entity.CpsQuestionInfo; | |||
import com.digiwin.athena.app.infra.entity.SalesOrderDetailEntity; | |||
import com.digiwin.athena.app.infra.service.CpsQuestionInfoService; | |||
import com.digiwin.athena.opt.common.eai.EAIRequest; | |||
import com.digiwin.athena.opt.common.eai.EAIUtil; | |||
import com.digiwin.athena.opt.common.eai.service.AbsEAIService; | |||
import javax.annotation.Resource; | |||
import java.util.List; | |||
import java.util.Map; | |||
/** | |||
* CpsQuestionCreateService | |||
* | |||
* @author DONGSK 2023/6/30 19:57 | |||
* @since 1.0.0 | |||
*/ | |||
public class CpsQuestionCreateService extends AbsEAIService { | |||
@Resource | |||
CpsQuestionInfoService cpsQuestionInfoService; | |||
@Override | |||
public String getServiceName() { | |||
return CpsUtil.CPS_QUESTION_INFO_CREATE; | |||
} | |||
@Override | |||
public DWEAIResult execute(Map<String, String> headers, String messageBody) throws Exception { | |||
EAIRequest request = EAIRequest.build(messageBody); | |||
List<CpsQuestionInfo> questionInfo = request.getObject("question_info", new TypeReference<List<CpsQuestionInfo>>() { | |||
}); | |||
cpsQuestionInfoService.saveBatch(questionInfo); | |||
return buildOK("question_info", questionInfo); | |||
} | |||
} |
@ -0,0 +1,93 @@ | |||
/* | |||
* Author: DONGSK | |||
* Datetime: 2023/6/30 19:57 | |||
* Description: | |||
* History: | |||
* 作者姓名 --修改时间 --版本号--描述 | |||
*/ | |||
package com.digiwin.athena.app.service.cps; | |||
import com.alibaba.fastjson.TypeReference; | |||
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; | |||
import com.digiwin.app.service.DWEAIResult; | |||
import com.digiwin.athena.app.infra.entity.CpsQuestionInfo; | |||
import com.digiwin.athena.app.infra.service.CpsQuestionInfoService; | |||
import com.digiwin.athena.opt.common.eai.EAIRequest; | |||
import com.digiwin.athena.opt.common.eai.service.AbsEAIService; | |||
import com.digiwin.athena.opt.persistence.domain.BaseMgrEntity; | |||
import org.apache.commons.lang3.StringUtils; | |||
import javax.annotation.Resource; | |||
import java.util.List; | |||
import java.util.Map; | |||
import java.util.stream.Collectors; | |||
/** | |||
* CpsQuestionUpdateService | |||
* | |||
* @author DONGSK 2023/6/30 19:57 | |||
* @since 1.0.0 | |||
*/ | |||
public class CpsQuestionGetService extends AbsEAIService { | |||
@Resource | |||
CpsQuestionInfoService cpsQuestionInfoService; | |||
@Override | |||
public String getServiceName() { | |||
return CpsUtil.CPS_QUESTION_INFO_GET; | |||
} | |||
@Override | |||
public DWEAIResult execute(Map<String, String> headers, String messageBody) throws Exception { | |||
EAIRequest eaiRequest = new EAIRequest(messageBody); | |||
String option = eaiRequest.getString("option"); | |||
// 侦测 | |||
if (StringUtils.isBlank(option)) { | |||
List<CpsQuestionInfo> list = cpsQuestionInfoService.lambdaQuery().eq(CpsQuestionInfo::getStatus, 0).list(); | |||
List<Long> ids = list.stream().map(BaseMgrEntity::getId).collect(Collectors.toList()); | |||
cpsQuestionInfoService.lambdaUpdate().set(CpsQuestionInfo::getStatus, 1).in(CpsQuestionInfo::getId, ids).update(); | |||
return buildOK("change_objects", list); | |||
} | |||
// 任务卡查询 | |||
List<CpsQuestionInfo> questionInfo = eaiRequest.getObject("question_info", new TypeReference<List<CpsQuestionInfo>>() { | |||
}); | |||
List<Long> collectIds = questionInfo.stream().map(BaseMgrEntity::getId).collect(Collectors.toList()); | |||
String status = eaiRequest.getString("status"); | |||
LambdaQueryChainWrapper<CpsQuestionInfo> lambdaQuery = cpsQuestionInfoService.lambdaQuery().in(CpsQuestionInfo::getId, collectIds); | |||
switch (option) { | |||
case "1": | |||
lambdaQuery.eq(CpsQuestionInfo::getStatus1, status); | |||
break; | |||
case "2": | |||
lambdaQuery.eq(CpsQuestionInfo::getStatus2, status); | |||
break; | |||
case "3": | |||
lambdaQuery.eq(CpsQuestionInfo::getStatus3, status); | |||
break; | |||
case "4": | |||
lambdaQuery.eq(CpsQuestionInfo::getStatus4, status); | |||
break; | |||
case "5": | |||
lambdaQuery.eq(CpsQuestionInfo::getStatus5, status); | |||
break; | |||
case "6": | |||
lambdaQuery.eq(CpsQuestionInfo::getStatus6, status); | |||
break; | |||
} | |||
return buildOK("question_info", lambdaQuery.list()); | |||
} | |||
} |
@ -0,0 +1,75 @@ | |||
/* | |||
* Author: DONGSK | |||
* Datetime: 2023/6/30 19:57 | |||
* Description: | |||
* History: | |||
* 作者姓名 --修改时间 --版本号--描述 | |||
*/ | |||
package com.digiwin.athena.app.service.cps; | |||
import com.alibaba.fastjson.TypeReference; | |||
import com.digiwin.app.service.DWEAIResult; | |||
import com.digiwin.athena.app.infra.entity.CpsQuestionInfo; | |||
import com.digiwin.athena.app.infra.service.CpsQuestionInfoService; | |||
import com.digiwin.athena.opt.common.eai.EAIRequest; | |||
import com.digiwin.athena.opt.common.eai.service.AbsEAIService; | |||
import javax.annotation.Resource; | |||
import java.util.List; | |||
import java.util.Map; | |||
/** | |||
* CpsQuestionUpdateService | |||
* | |||
* @author DONGSK 2023/6/30 19:57 | |||
* @since 1.0.0 | |||
*/ | |||
public class CpsQuestionUpdateService extends AbsEAIService { | |||
@Resource | |||
CpsQuestionInfoService cpsQuestionInfoService; | |||
@Override | |||
public String getServiceName() { | |||
return CpsUtil.CPS_QUESTION_INFO_UPDATE; | |||
} | |||
@Override | |||
public DWEAIResult execute(Map<String, String> headers, String messageBody) throws Exception { | |||
EAIRequest request = EAIRequest.build(messageBody); | |||
List<CpsQuestionInfo> questionInfo = request.getObject("question_info", new TypeReference<List<CpsQuestionInfo>>() { | |||
}); | |||
String option = request.getString("option"); | |||
questionInfo.forEach(o -> { | |||
switch (option) { | |||
case "1": | |||
o.setStatus1(1); | |||
break; | |||
case "2": | |||
o.setStatus1(2); | |||
break; | |||
case "3": | |||
o.setStatus1(3); | |||
break; | |||
case "4": | |||
o.setStatus1(4); | |||
break; | |||
case "5": | |||
o.setStatus1(5); | |||
break; | |||
case "6": | |||
o.setStatus1(6); | |||
break; | |||
} | |||
}); | |||
cpsQuestionInfoService.updateBatchById(questionInfo); | |||
return buildOK(); | |||
} | |||
} |
@ -0,0 +1,22 @@ | |||
/* | |||
* Author: DONGSK | |||
* Datetime: 2023/6/30 19:52 | |||
* Description: | |||
* History: | |||
* 作者姓名 --修改时间 --版本号--描述 | |||
*/ | |||
package com.digiwin.athena.app.service.cps; | |||
/** | |||
* CpsUtil | |||
* | |||
* @author DONGSK 2023/6/30 19:52 | |||
* @since 1.0.0 | |||
*/ | |||
public class CpsUtil { | |||
public static final String CPS_QUESTION_INFO_CREATE = "demo.cps.question.info.create"; | |||
public static final String CPS_QUESTION_INFO_UPDATE = "demo.cps.question.info.update"; | |||
public static final String CPS_QUESTION_INFO_GET = "demo.cps.question.info.get"; | |||
} |
@ -0,0 +1,42 @@ | |||
-- cps_question_info 问题管理 | |||
CREATE TABLE `cps_question_info` | |||
( | |||
`id` BIGINT(20) NOT NULL, | |||
`defect_type` VARCHAR(520) NULL DEFAULT '' COLLATE 'utf8mb4_general_ci', | |||
`question_location` VARCHAR(520) NULL DEFAULT '' COLLATE 'utf8mb4_general_ci', | |||
`question_area` VARCHAR(520) NULL DEFAULT '' COLLATE 'utf8mb4_general_ci', | |||
`question_time` DATETIME NULL DEFAULT NULL, | |||
`question_level` VARCHAR(520) NULL DEFAULT '' COLLATE 'utf8mb4_general_ci', | |||
`importance_level` VARCHAR(520) NULL DEFAULT '' COLLATE 'utf8mb4_general_ci', | |||
`times_one_day` VARCHAR(520) NULL DEFAULT '' COLLATE 'utf8mb4_general_ci', | |||
`question_information` VARCHAR(520) NULL DEFAULT '' COLLATE 'utf8mb4_general_ci', | |||
`responsible_person` VARCHAR(520) NULL DEFAULT '' COLLATE 'utf8mb4_general_ci', | |||
`containment_measures` VARCHAR(520) NULL DEFAULT '' COLLATE 'utf8mb4_general_ci', | |||
`root_cause_identification` VARCHAR(520) NULL DEFAULT '' COLLATE 'utf8mb4_general_ci', | |||
`corrective_actions` VARCHAR(520) NULL DEFAULT '' COLLATE 'utf8mb4_general_ci', | |||
`effect_verification` VARCHAR(520) NULL DEFAULT '' COLLATE 'utf8mb4_general_ci', | |||
`control_standards` VARCHAR(520) NULL DEFAULT '' COLLATE 'utf8mb4_general_ci', | |||
`completion_time` VARCHAR(520) NULL DEFAULT '' COLLATE 'utf8mb4_general_ci', | |||
`control_area` DATETIME NULL DEFAULT NULL, | |||
`knowledge_accumulation` VARCHAR(520) NULL DEFAULT '' COLLATE 'utf8mb4_general_ci', | |||
`status` INT(2) NULL DEFAULT '0' COMMENT '状态', | |||
`status1` INT(2) NULL DEFAULT '0' COMMENT '状态1', | |||
`status2` INT(2) NULL DEFAULT '0' COMMENT '状态2', | |||
`status3` INT(2) NULL DEFAULT '0' COMMENT '状态3', | |||
`status4` INT(2) NULL DEFAULT '0' COMMENT '状态4', | |||
`status5` INT(2) NULL DEFAULT '0' COMMENT '状态5', | |||
`status6` INT(2) NULL DEFAULT '0' COMMENT '状态6', | |||
`timestamp` VARCHAR(20) NULL DEFAULT NULL COLLATE 'utf8mb4_general_ci', | |||
`tenantsid` BIGINT(20) NULL DEFAULT NULL, | |||
`tenant_id` VARCHAR(20) NULL DEFAULT NULL COLLATE 'utf8mb4_general_ci', | |||
`create_by` VARCHAR(50) NULL DEFAULT NULL COLLATE 'utf8mb4_general_ci', | |||
`create_date` DATETIME NULL DEFAULT NULL, | |||
`modified_by` VARCHAR(50) NULL DEFAULT NULL COLLATE 'utf8mb4_general_ci', | |||
`modified_date` DATETIME NULL DEFAULT NULL, | |||
`version` INT(11) NULL DEFAULT NULL, | |||
`deleted` TINYINT(255) NULL DEFAULT NULL, | |||
PRIMARY KEY (`id`) USING BTREE | |||
) COMMENT='cps_问题追踪' | |||
COLLATE='utf8mb4_general_ci' | |||
ENGINE=InnoDB | |||
; |
@ -1 +0,0 @@ | |||
-- cim_wo_routing 工单工艺数据 |