Commit b4c173a4 by huluobin

工资系统推送费用单

parent 4f128a7c
......@@ -6,10 +6,7 @@ import com.blt.other.other_commons.utils.CurUtils;
import com.blt.other.other_commons.utils.DateTimeUtil;
import com.blt.other.other_commons.utils.HttpUtil;
import com.blt.other.other_commons.utils.PathUtil;
import com.blt.other.other_cost.dao.CostDao;
import com.blt.other.other_cost.dao.CostDetailDao;
import com.blt.other.other_cost.dao.CostTypeDao;
import com.blt.other.other_cost.dao.CostTypeKindDao;
import com.blt.other.other_cost.dao.*;
import com.blt.other.other_cost.dto.*;
import com.blt.other.other_cost.service.CostApiService;
import com.blt.other.other_cost.service.CostService;
......@@ -63,6 +60,9 @@ public class CostApiServiceImpl implements CostApiService {
@Value("${url.api.getExchangeRateApi}")
private String getExchangeRateApi;
@Autowired
CostLogDao costLogDao;
@Override
@Transactional
public String generateLogisticsCost(int costForm, LogisticsCostDto logisticsCostDto) throws Exception {
......@@ -340,6 +340,7 @@ public class CostApiServiceImpl implements CostApiService {
costLogDomain.setUpdateTime(new Date());
costLogDomain.setUpdateNote("老板已经审批通过了");
costLogDomain.setUpdateUsercode(user.getUsercode());
costLogDao.insert(costLogDomain);
return costNo;
}
......
......@@ -4,10 +4,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.*;
import java.util.UUID;
/**
......@@ -56,11 +53,11 @@ public class CostFileUtil {
dir.mkdirs();
dest.createNewFile();
}
InputStream inputStream = new FileInputStream(fileName);
OutputStream outputStream = new FileOutputStream(fileName);
int size = inputStream.read(bytes);
log.info("文件大小:{}", size);
inputStream.close();
outputStream.write(bytes);
outputStream.close();
return fileName;
}
......
package com.blt.other.other_cost.utils;
import com.blt.other.other_commons.utils.PathUtil;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.web.client.RestTemplate;
import java.io.IOException;
/**
* <p>
*
* </p>
*
* @author robbendev
* @since 2020/9/28 5:25 下午
*/
@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest
public class CostFileUtilTest {
@Test
public void upload() {
}
@Test
public void testUpload() throws IOException {
RestTemplate restTemplate = new RestTemplate();
byte[] bytes = restTemplate.getForObject("http://imgcache.bailuntec.com/20200928170018adb228b6-f277-40ff-8d70-1a6da09c82aa工资条附件.xlsx", byte[].class);
// 文件上传的路径
String filePath = "/Users/huluobin/Downloads/";
// 调用工具类执行保存,并返回 path
String path = CostFileUtil.upload("http://imgcache.bailuntec.com/20200928170018adb228b6-f277-40ff-8d70-1a6da09c82aa工资条附件.xlsx", filePath);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment