yangys
2025-09-20 fcee672452c02cc29e0e17ebc27a8c51698c6d0d
blade-service/blade-mdm/src/main/java/org/springblade/mdm/test/MyTestController.java
@@ -1,5 +1,7 @@
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;
@@ -10,12 +12,18 @@
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.MachineFile;
import org.springblade.mdm.machinefile.service.MachineFileScanService;
import org.springblade.mdm.program.entity.NcNode;
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.task.InternalEmailNotifyTask;
@@ -32,6 +40,7 @@
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Date;
import java.util.List;
@Slf4j
@@ -42,9 +51,8 @@
   @Autowired
   private NcNodeService service;
   @Autowired
   private MachineFileScanTask machineFileScanTask;
   private MesSyncService mesSyncService;
   @Autowired
   private ProgramAnnotationService programAnnotationService;
   @Autowired
@@ -57,6 +65,9 @@
   private WIthdrawService withdrawService;
   @Autowired
   private InternalEmailNotifyTask notifyTask;
   @Autowired
   private NcNodeHisService nodeHisService;
   /**
    * 新增
    */
@@ -106,8 +117,8 @@
   @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();
   }
@@ -127,4 +138,41 @@
      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);
   }
}