| | |
| | | import com.chinaztt.mes.common.oa.OAResult; |
| | | import com.chinaztt.mes.common.util.StateResult; |
| | | import com.chinaztt.mes.common.util.WechatMsgTips; |
| | | import com.chinaztt.mes.common.util.easyexcel.EasyExcelUtils; |
| | | import com.chinaztt.mes.common.wechat.WechatProperty; |
| | | import com.chinaztt.mes.plan.dto.*; |
| | | import com.chinaztt.mes.plan.entity.*; |
| | |
| | | import com.chinaztt.mes.plan.util.CustomerOrderClientConfigure; |
| | | import com.chinaztt.mes.plan.util.CustomerOrderUnitWhiteListConfig; |
| | | import com.chinaztt.mes.plan.util.CustomerOrderUtil; |
| | | import com.chinaztt.mes.plan.util.FileSaveUtil; |
| | | import com.chinaztt.mes.plan.vo.CustomerOrderVO1; |
| | | import com.chinaztt.mes.quality.dto.CustomOrderSyncDTO; |
| | | import com.chinaztt.mes.technology.entity.*; |
| | |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.FileInputStream; |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | import java.math.BigDecimal; |
| | |
| | | private final static String MO_RETURN_STAFF = "MO_RETURN_STAFF"; |
| | | |
| | | private Environment environment; |
| | | |
| | | private final static String OTC_MAIN_STATUS_CANCEL = "已取消"; |
| | | |
| | | private final static String OTC_MAIN_STATUS_TRANSMIT = "已下达"; |
| | | |
| | | private final static String AFFILIATED_CONTRACT = "中天注塑厂"; |
| | | |
| | | |
| | | |
| | | @Override |
| | | public void otcDownload(Long id, HttpServletResponse response) { |
| | |
| | | * @return |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R otcCustomerOrderSync(String selectTime, String pathCode) { |
| | | try { |
| | | if (StringUtils.isBlank(selectTime)) { |
| | |
| | | //所属工厂 |
| | | String affiliatedContract=customerJSONObject.getString("affiliatedContract"); |
| | | //只拉取所属公司为中天海洋系统有限公司的数据 |
| | | if (!"中天材料厂".equals(affiliatedContract)){ |
| | | if (!AFFILIATED_CONTRACT.equals(affiliatedContract)){ |
| | | continue; |
| | | } |
| | | // 不在这几个状态中的数据就跳过 |
| | |
| | | customer = new Customer(); |
| | | } |
| | | //如果OTC中主表状态是取消那就跳过或者删除已经同步的数据 |
| | | if ("已取消".equals(otcMainStatus)) { |
| | | if (OTC_MAIN_STATUS_CANCEL.equals(otcMainStatus)) { |
| | | if (customer.getId() != null) { |
| | | customerMapper.deleteById(customer.getId()); |
| | | baseMapper.delete(Wrappers.<CustomerOrder>lambdaQuery().eq(CustomerOrder::getCustomerId, customer.getId())); |
| | | } |
| | | continue; |
| | | } |
| | | if (!"已下达".equals(otcMainStatus)) {//null == affiliatedCompany || !Arrays.asList("已下达").contains(otcMainStatus) /*|| affiliatedCompany.equals("江苏中天科技股份有限公司")*/) { |
| | | if (!OTC_MAIN_STATUS_TRANSMIT.equals(otcMainStatus)) {//null == affiliatedCompany || !Arrays.asList("已下达").contains(otcMainStatus) /*|| affiliatedCompany.equals("江苏中天科技股份有限公司")*/) { |
| | | continue;//只获取OTC中已审核及已下达的订单, |
| | | } |
| | | //客户编号 |
| | |
| | | |
| | | @Override |
| | | public R uploadProcessConfigFile(MultipartFile file, String orderNumber, String lineNumber) { |
| | | String fileName = IdUtil.simpleUUID() + StrUtil.DOT + FileUtil.extName(file.getOriginalFilename()); |
| | | String fileName = FileUtil.extName(file.getOriginalFilename()); |
| | | try { |
| | | minioTemplate.putObject(ossProperties.getBucketName(), fileName, file.getInputStream()); |
| | | OrderProcessConfigFile configFile = new OrderProcessConfigFile(); |
| | | configFile.setFileName(fileName); |
| | | configFile.setOriginalFileName(file.getOriginalFilename()); |
| | | configFile.setOrderNumber(orderNumber); |
| | | configFile.setLineNumber(lineNumber); |
| | | configFile.setBucketName(ossProperties.getBucketName()); |
| | | configFile.setBucketName(FileSaveUtil.StoreFile(file)); |
| | | orderProcessConfigFileMapper.insert(configFile); |
| | | ProcessConfigFileOrderMapping mapping = ProcessConfigFileOrderMapping.builder().configFileId(configFile.getId()) |
| | | .orderNumber(orderNumber).lineNumber(lineNumber).build(); |
| | |
| | | |
| | | @Override |
| | | public void getFile(String bucket, String fileName, HttpServletResponse response) { |
| | | try (InputStream inputStream = minioTemplate.getObject(bucket, fileName)) { |
| | | try { |
| | | String path = FileSaveUtil.FILE_PATH + bucket; |
| | | InputStream inputStream = new FileInputStream(path); |
| | | // EasyExcel.write(path).sheet().doWrite(null); |
| | | response.setContentType("application/octet-stream; charset=UTF-8"); |
| | | IoUtil.copy(inputStream, response.getOutputStream()); |
| | | } catch (Exception e) { |