优化收款单
This commit is contained in:
@@ -52,6 +52,8 @@ public class AccountItemController {
|
||||
item.put("inOutItemId", ai.getInOutItemId());
|
||||
item.put("inOutItemName", ai.getInOutItemName());
|
||||
item.put("billNumber", ai.getBillNumber());
|
||||
item.put("needDebt", ai.getNeedDebt());
|
||||
item.put("finishDebt", ai.getFinishDebt());
|
||||
BigDecimal eachAmount = ai.getEachAmount();
|
||||
item.put("eachAmount", (eachAmount.compareTo(BigDecimal.ZERO))==-1 ? BigDecimal.ZERO.subtract(eachAmount): eachAmount);
|
||||
item.put("remark", ai.getRemark());
|
||||
|
||||
@@ -14,10 +14,7 @@ import com.jsh.erp.exception.BusinessParamCheckingException;
|
||||
import com.jsh.erp.service.depotHead.DepotHeadService;
|
||||
import com.jsh.erp.service.log.LogService;
|
||||
import com.jsh.erp.service.redis.RedisService;
|
||||
import com.jsh.erp.utils.BaseResponseInfo;
|
||||
import com.jsh.erp.utils.ErpInfo;
|
||||
import com.jsh.erp.utils.StringUtil;
|
||||
import com.jsh.erp.utils.Tools;
|
||||
import com.jsh.erp.utils.*;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
@@ -425,4 +422,35 @@ public class DepotHeadController {
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询存在欠款的单据
|
||||
* @param search
|
||||
* @param request
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@GetMapping(value = "/debtList")
|
||||
public String debtList(@RequestParam(value = Constants.SEARCH, required = false) String search,
|
||||
HttpServletRequest request)throws Exception {
|
||||
Map<String, Object> objectMap = new HashMap<>();
|
||||
String organIdStr = StringUtil.getInfo(search, "organId");
|
||||
Long organId = Long.parseLong(organIdStr);
|
||||
String materialParam = StringUtil.getInfo(search, "materialParam");
|
||||
String number = StringUtil.getInfo(search, "number");
|
||||
String beginTime = StringUtil.getInfo(search, "beginTime");
|
||||
String endTime = StringUtil.getInfo(search, "endTime");
|
||||
String type = StringUtil.getInfo(search, "type");
|
||||
String subType = StringUtil.getInfo(search, "subType");
|
||||
String roleType = StringUtil.getInfo(search, "roleType");
|
||||
String status = StringUtil.getInfo(search, "status");
|
||||
List<DepotHeadVo4List> list = depotHeadService.debtList(organId, materialParam, number, beginTime, endTime, type, subType, roleType, status);
|
||||
if (list != null) {
|
||||
objectMap.put("rows", list);
|
||||
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
|
||||
} else {
|
||||
objectMap.put("rows", new ArrayList<>());
|
||||
return returnJson(objectMap, "查找不到数据", ErpInfo.OK.code);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,14 +11,22 @@ import com.jsh.erp.service.systemConfig.SystemConfigService;
|
||||
import com.jsh.erp.service.user.UserService;
|
||||
import com.jsh.erp.service.userBusiness.UserBusinessService;
|
||||
import com.jsh.erp.utils.BaseResponseInfo;
|
||||
import com.jsh.erp.utils.FileUtils;
|
||||
import com.jsh.erp.utils.StringUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.dao.DataAccessException;
|
||||
import org.springframework.util.FileCopyUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -43,6 +51,9 @@ public class SystemConfigController {
|
||||
@Resource
|
||||
private SystemConfigService systemConfigService;
|
||||
|
||||
@Value(value="${file.path}")
|
||||
private String filePath;
|
||||
|
||||
@GetMapping(value = "/getDictItems/{dictCode}")
|
||||
public BaseResponseInfo getDictItems(@PathVariable String dictCode,
|
||||
HttpServletRequest request) {
|
||||
@@ -107,4 +118,78 @@ public class SystemConfigController {
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 文件上传统一方法
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/upload")
|
||||
public BaseResponseInfo upload(HttpServletRequest request, HttpServletResponse response) {
|
||||
BaseResponseInfo res = new BaseResponseInfo();
|
||||
try {
|
||||
String savePath = "";
|
||||
String bizPath = request.getParameter("biz");
|
||||
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
|
||||
MultipartFile file = multipartRequest.getFile("file");// 获取上传文件对象
|
||||
if(StringUtil.isEmpty(bizPath)){
|
||||
bizPath = "";
|
||||
}
|
||||
savePath = this.uploadLocal(file,bizPath);
|
||||
if(StringUtil.isNotEmpty(savePath)){
|
||||
res.code = 200;
|
||||
res.data = savePath;
|
||||
}else {
|
||||
res.code = 500;
|
||||
res.data = "上传失败!";
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
res.code = 500;
|
||||
res.data = "上传失败!";
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* 本地文件上传
|
||||
* @param mf 文件
|
||||
* @param bizPath 自定义路径
|
||||
* @return
|
||||
*/
|
||||
private String uploadLocal(MultipartFile mf,String bizPath){
|
||||
try {
|
||||
String ctxPath = filePath;
|
||||
String fileName = null;
|
||||
File file = new File(ctxPath + File.separator + bizPath + File.separator );
|
||||
if (!file.exists()) {
|
||||
file.mkdirs();// 创建文件根目录
|
||||
}
|
||||
String orgName = mf.getOriginalFilename();// 获取文件名
|
||||
orgName = FileUtils.getFileName(orgName);
|
||||
if(orgName.indexOf(".")!=-1){
|
||||
fileName = orgName.substring(0, orgName.lastIndexOf(".")) + "_" + System.currentTimeMillis() + orgName.substring(orgName.indexOf("."));
|
||||
}else{
|
||||
fileName = orgName+ "_" + System.currentTimeMillis();
|
||||
}
|
||||
String savePath = file.getPath() + File.separator + fileName;
|
||||
File savefile = new File(savePath);
|
||||
FileCopyUtils.copy(mf.getBytes(), savefile);
|
||||
String dbpath = null;
|
||||
if(StringUtil.isNotEmpty(bizPath)){
|
||||
dbpath = bizPath + File.separator + fileName;
|
||||
}else{
|
||||
dbpath = fileName;
|
||||
}
|
||||
if (dbpath.contains("\\")) {
|
||||
dbpath = dbpath.replace("\\", "/");
|
||||
}
|
||||
return dbpath;
|
||||
} catch (IOException e) {
|
||||
logger.error(e.getMessage(), e);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user