| | |
| | | package org.springblade.mdm.test; |
| | | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import jakarta.mail.MessagingException; |
| | | import jakarta.xml.soap.SOAPException; |
| | | import jakarta.xml.ws.WebServiceContext; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.io.IOUtils; |
| | | import org.apache.neethi.AssertionBuilderFactory; |
| | | import org.apache.ws.commons.schema.XmlSchemaSerializer; |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springblade.core.tool.utils.DateUtil; |
| | | import org.springblade.core.tool.utils.SpringUtil; |
| | | import org.springblade.mdm.basesetting.machine.entity.Machine; |
| | | import org.springblade.mdm.commons.service.InternalEmailService; |
| | | import org.springblade.mdm.flow.entity.MesSync; |
| | | import org.springblade.mdm.flow.excution.events.CureFinishedEvent; |
| | | import org.springblade.mdm.flow.service.MesSyncService; |
| | | import org.springblade.mdm.flow.service.WIthdrawService; |
| | | import org.springblade.mdm.machinefile.entity.FileSendRecord; |
| | | import org.springblade.mdm.machinefile.entity.MachineFile; |
| | | import org.springblade.mdm.machinefile.service.FileSendRecordService; |
| | | import org.springblade.mdm.machinefile.service.MachineFileScanService; |
| | | import org.springblade.mdm.program.entity.NcNode; |
| | | import org.springblade.mdm.program.entity.ProgramOnMachine; |
| | | import org.springblade.mdm.program.service.NcNodeHisService; |
| | | import org.springblade.mdm.program.service.NcNodeService; |
| | | import org.springblade.mdm.program.service.ProgramAnnotationService; |
| | | import org.springblade.mdm.program.service.ProgramOnMachineService; |
| | | import org.springblade.mdm.task.InternalEmailNotifyTask; |
| | | import org.springblade.mdm.task.MachineFileScanTask; |
| | | import org.springblade.mdm.task.ReceiveDirCheckTask; |
| | | import org.springblade.mdm.utils.FileContentUtil; |
| | | import org.springblade.system.feign.IDictBizClient; |
| | | import org.springblade.system.pojo.entity.DictBiz; |
| | |
| | | import java.io.FileInputStream; |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Optional; |
| | | |
| | | @Slf4j |
| | | @RestController |
| | |
| | | |
| | | @Autowired |
| | | private NcNodeService service; |
| | | |
| | | @Autowired |
| | | private MachineFileScanTask machineFileScanTask; |
| | | private MesSyncService mesSyncService; |
| | | @Autowired |
| | | private ProgramAnnotationService programAnnotationService; |
| | | private ReceiveDirCheckTask fileCheckTask; |
| | | @Autowired |
| | | private IDictBizClient bizDictClient; |
| | | @Autowired |
| | |
| | | private WIthdrawService withdrawService; |
| | | @Autowired |
| | | private InternalEmailNotifyTask notifyTask; |
| | | |
| | | @Autowired |
| | | private NcNodeHisService nodeHisService; |
| | | @Autowired |
| | | private FileSendRecordService fileSendRecordService; |
| | | /** |
| | | * 新增 |
| | | */ |
| | |
| | | |
| | | @GetMapping("/sendmail") |
| | | @Operation(summary = "sendmail", description = "sendmail") |
| | | public R<Void> sendmail(String code) throws IOException, MessagingException { |
| | | |
| | | public R<Void> sendmail(String from,String to,String subject,String content) throws IOException, MessagingException { |
| | | this.mailService.send(from,to,null,null,subject,content,null); |
| | | return R.success(); |
| | | } |
| | | |
| | |
| | | SOAPException s; |
| | | notifyTask.execute(); |
| | | } |
| | | |
| | | @GetMapping("/movehis") |
| | | public void moveHis(Date time){ |
| | | //format:?time=2025-09-16%2010:11:10 |
| | | nodeHisService.mergeNodeToHisGeTime(time); |
| | | } |
| | | @GetMapping("/mes-sync") |
| | | public void mesSync(){ |
| | | mesSyncService.syncToMes(); |
| | | } |
| | | |
| | | @GetMapping("/publish-cure") |
| | | public void publishCure(){ |
| | | CureFinishedEvent e = new CureFinishedEvent(this,"0000000173"); |
| | | SpringUtil.publishEvent(e); |
| | | } |
| | | |
| | | @GetMapping("/call-mes") |
| | | public void callMess(){ |
| | | JSONObject jsonObject = new JSONObject(); |
| | | |
| | | JSONArray dataList = new JSONArray(); |
| | | |
| | | JSONObject item = new JSONObject(); |
| | | item.put("operationId","id1"); |
| | | item.put("programNo","00001"); |
| | | item.put("curedTime", DateUtil.formatDateTime(new Date())); |
| | | |
| | | dataList.add(item); |
| | | |
| | | jsonObject.put("batchData", dataList); |
| | | |
| | | log.info("mestest data:{}",jsonObject); |
| | | |
| | | int code = mesSyncService.postData(jsonObject); |
| | | log.info("mestest response:{}",code); |
| | | } |
| | | |
| | | @GetMapping("/check-files") |
| | | public void checkFiles(){ |
| | | fileCheckTask.checkFiles(); |
| | | } |
| | | |
| | | @GetMapping("/likeright") |
| | | public Object likeRight(){ |
| | | Optional<FileSendRecord> optFile = fileSendRecordService.lambdaQuery() |
| | | .eq(FileSendRecord::getMachineCode,"P01") |
| | | .likeRight(FileSendRecord::getName,"a-P%").last("limit 1") |
| | | .orderByDesc(FileSendRecord::getCreateTime).oneOpt(); |
| | | |
| | | return optFile.get(); |
| | | } |
| | | } |