Commit 4271c70a by huluobin

不知道改了什么

parent 15ab7751
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
<mybatis.version>3.4.1</mybatis.version> <mybatis.version>3.4.1</mybatis.version>
<mybatis.spring.version>1.3.2</mybatis.spring.version> <mybatis.spring.version>1.3.2</mybatis.spring.version>
<mysql.version>5.1.47</mysql.version> <mysql.version>5.1.47</mysql.version>
<commons.lang3>3.4</commons.lang3>
<pagehelper.spring.boot.starter>1.2.5</pagehelper.spring.boot.starter> <pagehelper.spring.boot.starter>1.2.5</pagehelper.spring.boot.starter>
<druid.spring.boot.starter>1.1.9</druid.spring.boot.starter> <druid.spring.boot.starter>1.1.9</druid.spring.boot.starter>
<fastjson>1.2.47</fastjson> <fastjson>1.2.47</fastjson>
...@@ -104,11 +103,6 @@ ...@@ -104,11 +103,6 @@
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>${commons.lang3}</version>
</dependency>
<dependency> <dependency>
<groupId>com.fasterxml.jackson.core</groupId> <groupId>com.fasterxml.jackson.core</groupId>
......
...@@ -9,16 +9,15 @@ import com.blt.other.other_cost.service.CostService; ...@@ -9,16 +9,15 @@ import com.blt.other.other_cost.service.CostService;
import com.blt.other.other_cost.service.CostTypeKindService; import com.blt.other.other_cost.service.CostTypeKindService;
import com.blt.other.other_cost.utils.CostFileUtil; import com.blt.other.other_cost.utils.CostFileUtil;
import com.blt.other.other_database.model.CostDetailDomain; import com.blt.other.other_database.model.CostDetailDomain;
import com.blt.other.other_database.model.CostPlanTempDomain;
import com.blt.other.other_database.model.CostTypeKindDomain; import com.blt.other.other_database.model.CostTypeKindDomain;
import com.blt.other.other_database.model.UserDomain; import com.blt.other.other_database.model.UserDomain;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.FileSystemResource; import org.springframework.core.io.FileSystemResource;
import org.springframework.core.io.InputStreamResource; import org.springframework.core.io.InputStreamResource;
import org.springframework.http.HttpHeaders; import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.lang.NonNullApi;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
...@@ -48,31 +47,43 @@ public class CostDetailController { ...@@ -48,31 +47,43 @@ public class CostDetailController {
private UserService userService; private UserService userService;
@PostMapping("/getCostDetailList") @PostMapping("/getCostDetailList")
public Map<String,Object> getCostDetailList(HttpServletResponse response, HttpServletRequest request,Integer userId){ public Map<String, Object> getCostDetailList(HttpServletResponse response, HttpServletRequest request, Integer userId) {
AxiosUtil.setCors(response,request); AxiosUtil.setCors(response, request);
String costNo = request.getParameter("costNo"); String costNo = request.getParameter("costNo");
List<CostDetailDomain> costDetailListByCostNo = costDetailService.getCostDetailListByCostNo(costNo); List<CostDetailDomain> costDetailListByCostNo = costDetailService.getCostDetailListByCostNo(costNo);
Map<String,Object> result = new HashMap<>(); Map<String, Object> result = new HashMap<>();
UserDomain user = userService.findByUserid(userId); UserDomain user = userService.findByUserid(userId);
for (CostDetailDomain detail : costDetailListByCostNo) { for (CostDetailDomain detail : costDetailListByCostNo) {
if (detail != null && costDetailListByCostNo.size() > 0){ if (detail != null && costDetailListByCostNo.size() > 0) {
//类型标题 大类 //类型标题 大类
String typeName = detail.getTypeName(); String typeName = detail.getTypeName();
//种类标题 小类 //种类标题 小类
String kindName = detail.getKindName(); String kindName = detail.getKindName();
if ((typeName.contains("工资") || kindName.contains("工资")) && !(user.getUseraccount().equals("程文爱") || user.getUseraccount().equals("苏佩虹") || user.getUseraccount().equals("张晓雯") || user.getUseraccount().equals("王埕") || user.getUseraccount().equals("赵伟铭") || user.getUseraccount().equals("李静雯") || user.getUseraccount().equals("董梓玲")||user.getUseraccount().equals("简金源") ||detail.getCreateUsername().equals(user.getUseraccount()))){ if ((typeName.contains("工资") ||
kindName.contains("工资")) &&
!(user.getUseraccount().equals("程文爱")
|| user.getUseraccount().equals("苏佩虹")
|| user.getUseraccount().equals("张晓雯")
|| user.getUseraccount().equals("王埕")
|| user.getUseraccount().equals("赵伟铭")
|| user.getUseraccount().equals("李静雯")
|| user.getUseraccount().equals("董梓玲")
|| user.getUseraccount().equals("简金源")
|| user.getUseraccount().equals("廖文珊")
|| user.getUseraccount().equals("李燕霞")
|| detail.getCreateUsername().equals(user.getUseraccount()))) {
detail.setFilePath(""); detail.setFilePath("");
} }
if (detail.getFilePath()== null){ if (detail.getFilePath() == null) {
detail.setFilePath(""); detail.setFilePath("");
} }
} }
} }
result.put("costDetails",costDetailListByCostNo); result.put("costDetails", costDetailListByCostNo);
return result; return result;
} }
...@@ -84,13 +95,13 @@ public class CostDetailController { ...@@ -84,13 +95,13 @@ public class CostDetailController {
String fileName = null; String fileName = null;
if (null != detail) { if (null != detail) {
filePath = detail.getFilePath(); filePath = detail.getFilePath();
if (null != filePath){ if (null != filePath) {
String[] split = filePath.split("&"); String[] split = filePath.split("&");
if (null != split && split.length>=1){ if (null != split && split.length >= 1) {
fileName = split[split.length-1]; fileName = split[split.length - 1];
} }
} }
}else { } else {
return null; return null;
} }
...@@ -98,7 +109,7 @@ public class CostDetailController { ...@@ -98,7 +109,7 @@ public class CostDetailController {
HttpHeaders headers = new HttpHeaders(); HttpHeaders headers = new HttpHeaders();
headers.add("Cache-Control", "no-cache, no-store, must-revalidate"); headers.add("Cache-Control", "no-cache, no-store, must-revalidate");
// new String(fileName.getBytes("UTF-8"),"iso-8859-1") 解决文件下载的时候文件名乱码的问题 // new String(fileName.getBytes("UTF-8"),"iso-8859-1") 解决文件下载的时候文件名乱码的问题
headers.add("Content-Disposition", String.format("attachment; filename=\"%s\"", new String(fileName.getBytes("UTF-8"),"iso-8859-1"))); headers.add("Content-Disposition", String.format("attachment; filename=\"%s\"", new String(fileName.getBytes("UTF-8"), "iso-8859-1")));
headers.add("Pragma", "no-cache"); headers.add("Pragma", "no-cache");
headers.add("Expires", "0"); headers.add("Expires", "0");
...@@ -111,38 +122,38 @@ public class CostDetailController { ...@@ -111,38 +122,38 @@ public class CostDetailController {
} }
@GetMapping("/getDetailByNo") @GetMapping("/getDetailByNo")
public Map<String,Object> getDetailByNo(HttpServletResponse response,HttpServletRequest request){ public Map<String, Object> getDetailByNo(HttpServletResponse response, HttpServletRequest request) {
AxiosUtil.setCors(response,request); AxiosUtil.setCors(response, request);
String detailNo = request.getParameter("detailNo"); String detailNo = request.getParameter("detailNo");
CostDetailDomain costDetailByDetailNo = costDetailService.getCostDetailByDetailNo(detailNo); CostDetailDomain costDetailByDetailNo = costDetailService.getCostDetailByDetailNo(detailNo);
Map<String,Object> result = new HashMap<>(); Map<String, Object> result = new HashMap<>();
result.put("detail",costDetailByDetailNo); result.put("detail", costDetailByDetailNo);
if(null != costDetailByDetailNo.getFilePath() && !costDetailByDetailNo.getFilePath().isEmpty()){ if (null != costDetailByDetailNo.getFilePath() && !costDetailByDetailNo.getFilePath().isEmpty()) {
String filePath = costDetailByDetailNo.getFilePath(); String filePath = costDetailByDetailNo.getFilePath();
int i = filePath.lastIndexOf("&"); int i = filePath.lastIndexOf("&");
String substring = filePath.substring(i+1, filePath.length()); String substring = filePath.substring(i + 1, filePath.length());
result.put("fileName",substring); result.put("fileName", substring);
} }
return result; return result;
} }
@PostMapping("/resetItem/noFile") @PostMapping("/resetItem/noFile")
public Map<String,Object> resetNoFile(HttpServletResponse response, HttpServletRequest request){ public Map<String, Object> resetNoFile(HttpServletResponse response, HttpServletRequest request) {
AxiosUtil.setCors(response,request); AxiosUtil.setCors(response, request);
CostDetailDomain domain = createDomain(request); CostDetailDomain domain = createDomain(request);
String delecteFile = request.getParameter("delecteFile"); String delecteFile = request.getParameter("delecteFile");
boolean b = Boolean.parseBoolean(delecteFile); boolean b = Boolean.parseBoolean(delecteFile);
if (b){ if (b) {
costDetailService.deleteFilePath(domain.getDetailNo()); costDetailService.deleteFilePath(domain.getDetailNo());
} }
Map<String,Object> result = new HashMap<>(); Map<String, Object> result = new HashMap<>();
result.put("success",true); result.put("success", true);
// 判断是否更改了费用小类 // 判断是否更改了费用小类
// String changeKindStr = request.getParameter("changeKind"); // String changeKindStr = request.getParameter("changeKind");
// boolean changeKind = Boolean.parseBoolean(changeKindStr); // boolean changeKind = Boolean.parseBoolean(changeKindStr);
// if (changeKind) { // if (changeKind) {
// 判断更改的费用小类是否已经存在 // 判断更改的费用小类是否已经存在
// result = checkResetKind(result, domain); // result = checkResetKind(result, domain);
// if (!(boolean) result.get("success")) { // if (!(boolean) result.get("success")) {
// return result; // return result;
...@@ -150,33 +161,33 @@ public class CostDetailController { ...@@ -150,33 +161,33 @@ public class CostDetailController {
// } // }
Integer update = costDetailService.update(domain); Integer update = costDetailService.update(domain);
if (null != update && update >= 1){ if (null != update && update >= 1) {
// 更新费用单信息 // 更新费用单信息
costService.resetCost(domain.getCostNo()); costService.resetCost(domain.getCostNo());
} }
result.put("detail",domain); result.put("detail", domain);
return result; return result;
} }
@PostMapping("/resetItem/file") @PostMapping("/resetItem/file")
public Map<String,Object> resetFile(HttpServletResponse response, HttpServletRequest request,@RequestParam("fileSelect2") MultipartFile file){ public Map<String, Object> resetFile(HttpServletResponse response, HttpServletRequest request, @RequestParam("fileSelect2") MultipartFile file) {
AxiosUtil.setCors(response,request); AxiosUtil.setCors(response, request);
CostDetailDomain domain = createDomain(request); CostDetailDomain domain = createDomain(request);
// 文件上传的路径 // 文件上传的路径
String filePath = PathUtil.getBasePath()+PathUtil.getPath("cost/"+domain.getDetailNo()+"/"); String filePath = PathUtil.getBasePath() + PathUtil.getPath("cost/" + domain.getDetailNo() + "/");
// 调用工具类执行保存,并返回 path // 调用工具类执行保存,并返回 path
String path = CostFileUtil.upload(file, filePath); String path = CostFileUtil.upload(file, filePath);
domain.setFilePath(path); domain.setFilePath(path);
Map<String,Object> result = new HashMap<>(); Map<String, Object> result = new HashMap<>();
result.put("success",true); result.put("success", true);
// 判断是否更改了费用小类 // 判断是否更改了费用小类
// String changeKindStr = request.getParameter("changeKind"); // String changeKindStr = request.getParameter("changeKind");
// boolean changeKind = Boolean.parseBoolean(changeKindStr); // boolean changeKind = Boolean.parseBoolean(changeKindStr);
// if (changeKind) { // if (changeKind) {
// 判断更改的费用小类是否已经存在 // 判断更改的费用小类是否已经存在
// result = checkResetKind(result, domain); // result = checkResetKind(result, domain);
// if (!(boolean) result.get("success")) { // if (!(boolean) result.get("success")) {
// return result; // return result;
...@@ -199,7 +210,7 @@ public class CostDetailController { ...@@ -199,7 +210,7 @@ public class CostDetailController {
// return result; // return result;
// } // }
private CostDetailDomain createDomain(HttpServletRequest request){ private CostDetailDomain createDomain(HttpServletRequest request) {
CostDetailDomain domain = new CostDetailDomain(); CostDetailDomain domain = new CostDetailDomain();
String costReason = request.getParameter("costReason"); String costReason = request.getParameter("costReason");
String amount = request.getParameter("amount"); String amount = request.getParameter("amount");
...@@ -220,11 +231,11 @@ public class CostDetailController { ...@@ -220,11 +231,11 @@ public class CostDetailController {
} }
@GetMapping("/getCostLogs") @GetMapping("/getCostLogs")
public Map<String,Object> getCostLogs(HttpServletResponse response,HttpServletRequest request){ public Map<String, Object> getCostLogs(HttpServletResponse response, HttpServletRequest request) {
AxiosUtil.setCors(response,request); AxiosUtil.setCors(response, request);
String costNo = request.getParameter("costNo"); String costNo = request.getParameter("costNo");
List<String> costLogs = costLogService.getListLogs(costLogService.getListByCostNo(costNo)); List<String> costLogs = costLogService.getListLogs(costLogService.getListByCostNo(costNo));
Map<String,Object> result = new HashMap<>(); Map<String, Object> result = new HashMap<>();
result.put("costLogs", costLogs); result.put("costLogs", costLogs);
return result; return result;
} }
......
# shellcheck disable=SC2164
cd /home/ubuntu/data/other/dc-cost-system/cost-core
git pull
# 拉取开发分支代码
git checkout master
#打包
mvn clean package -Dmaven.test.skip=true -Dmaven.compile.fork=true
# kill测试进程
# shellcheck disable=SC2009
ps -ef | grep cost-core | grep -v grep | grep prod | awk '{print $2}' | xargs kill -9
# 运行
nohup java -Xms512m -Xmx512m -Xss1M -jar -Dspring.profiles.active=prod /home/ubuntu/data/other/dc-cost-system/cost-core/target/cost-core-1.1.13.jar & \
...@@ -26,7 +26,7 @@ public class CostListSearchServiceTest { ...@@ -26,7 +26,7 @@ public class CostListSearchServiceTest {
@Test @Test
public void searchByKey() { public void searchByKey() {
Map<String, Object> result = costListSearchService.searchByKey("F024926,F024927,F024928", 1, 100); Map<String, Object> result = costListSearchService.searchByKey("生物", 1, 100);
System.out.println(JSON.toJSONString(result)); System.out.println(JSON.toJSONString(result));
} }
......
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