Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
45aa0ad6e8
|
|
@ -5,14 +5,13 @@ import java.math.BigDecimal;
|
|||
import java.math.RoundingMode;
|
||||
import java.net.URLEncoder;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.bonus.common.biz.config.PoiOutPage;
|
||||
import com.bonus.common.biz.enums.TmTaskTypeEnum;
|
||||
import com.bonus.common.log.enums.OperaType;
|
||||
|
|
@ -23,6 +22,7 @@ import com.bonus.material.countersign.domain.SignConfigVo;
|
|||
import com.bonus.material.lease.domain.vo.LeaseOutVo;
|
||||
import com.bonus.material.settlement.domain.SltAgreementApply;
|
||||
import com.bonus.material.settlement.domain.SltAgreementReduce;
|
||||
import com.bonus.material.settlement.domain.SltAgreementRelation;
|
||||
import com.bonus.material.settlement.domain.vo.SltInfoVo;
|
||||
import com.bonus.material.settlement.domain.vo.SltLeaseInfo;
|
||||
import com.bonus.material.settlement.mapper.SltAgreementInfoMapper;
|
||||
|
|
@ -32,16 +32,10 @@ import com.bonus.material.task.mapper.TmTaskMapper;
|
|||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import com.bonus.common.log.annotation.SysLog;
|
||||
import com.bonus.common.security.annotation.RequiresPermissions;
|
||||
import com.bonus.material.settlement.domain.SltAgreementInfo;
|
||||
|
|
@ -113,10 +107,67 @@ public class SltAgreementInfoController extends BaseController {
|
|||
|
||||
@ApiOperation(value = "根据协议获取结算清单")
|
||||
@PostMapping("/getSltInfo")
|
||||
public AjaxResult getSltInfo(@RequestBody SltAgreementInfo info) {
|
||||
SltInfoVo bean = sltAgreementInfoService.getSltInfo(info);
|
||||
public AjaxResult getSltInfo(@RequestBody List<SltAgreementInfo> list) {
|
||||
List<String> unitNames = new ArrayList<>();
|
||||
List<String> projectNames = new ArrayList<>();
|
||||
List<SltInfoVo> dataList = new ArrayList<>();
|
||||
SltInfoVo bean = new SltInfoVo();
|
||||
for (SltAgreementInfo info : list) {
|
||||
unitNames.add(info.getUnitName());
|
||||
projectNames.add(info.getProjectName());
|
||||
SltInfoVo vo = sltAgreementInfoService.getSltInfo(info);
|
||||
dataList.add(vo);
|
||||
}
|
||||
bean = mergerData(bean, dataList,unitNames,projectNames);
|
||||
return AjaxResult.success(bean);
|
||||
}
|
||||
public SltInfoVo mergerData(SltInfoVo vo,List<SltInfoVo> list,List<String> unitNames,List<String> projectNames){
|
||||
vo.setUnitName(handleData(unitNames));
|
||||
vo.setProjectName(handleData(projectNames));
|
||||
BigDecimal leaseCost = BigDecimal.valueOf(0.00);
|
||||
BigDecimal repairCost = BigDecimal.valueOf(0.00);
|
||||
BigDecimal scrapCost = BigDecimal.valueOf(0.00);
|
||||
BigDecimal loseCost = BigDecimal.valueOf(0.00);
|
||||
//租赁费用列表
|
||||
List<SltAgreementInfo> leaseList = new ArrayList<>();
|
||||
//维修费用列表
|
||||
List<SltAgreementInfo> repairList = new ArrayList<>();
|
||||
//报废费用列表
|
||||
List<SltAgreementInfo> scrapList = new ArrayList<>();
|
||||
//丢失费用列表
|
||||
List<SltAgreementInfo> loseList = new ArrayList<>();
|
||||
List<SltAgreementRelation> relations = new ArrayList<>();
|
||||
for (SltInfoVo infoVo : list) {
|
||||
leaseCost = leaseCost.add(infoVo.getLeaseCost());
|
||||
repairCost = repairCost.add(infoVo.getRepairCost());
|
||||
scrapCost = scrapCost.add(infoVo.getScrapCost());
|
||||
loseCost = loseCost.add(infoVo.getLoseCost());
|
||||
leaseList.addAll(infoVo.getLeaseList());
|
||||
repairList.addAll(infoVo.getRepairList());
|
||||
scrapList.addAll(infoVo.getScrapList());
|
||||
loseList.addAll(infoVo.getLoseList());
|
||||
relations.addAll(infoVo.getRelations());
|
||||
}
|
||||
vo.setLeaseList(leaseList);
|
||||
vo.setRepairList(repairList);
|
||||
vo.setScrapList(scrapList);
|
||||
vo.setLoseList(loseList);
|
||||
vo.setLeaseCost(leaseCost);
|
||||
vo.setRepairCost(repairCost);
|
||||
vo.setScrapCost(scrapCost);
|
||||
vo.setLoseCost(loseCost);
|
||||
vo.setRelations(relations);
|
||||
return vo;
|
||||
}
|
||||
|
||||
public String handleData(List<String> list){
|
||||
StringBuilder sb = new StringBuilder();
|
||||
Set<String> set = new HashSet<>(list);
|
||||
for (String str : set) {
|
||||
sb.append(str).append("、");
|
||||
}
|
||||
return StringUtils.removeEnd(sb.toString(), "、");
|
||||
}
|
||||
|
||||
@ApiOperation(value = "结算记录查询明细")
|
||||
@PostMapping("/getSltRecordDetailsList")
|
||||
|
|
@ -576,16 +627,22 @@ public class SltAgreementInfoController extends BaseController {
|
|||
// @RequiresPermissions("settlement:info:export")
|
||||
@SysLog(title = "结算信息", businessType = OperaType.EXPORT, logType = 1,module = "仓储管理->导出租赁明细")
|
||||
@PostMapping("/exportLease")
|
||||
public void exportLease(HttpServletResponse response, SltAgreementInfo sltAgreementInfo) {
|
||||
public void exportLease(HttpServletResponse response, @RequestParam("params") String params) {
|
||||
try {
|
||||
String fileName = "租赁费用明细表";
|
||||
String projectName = sltAgreementInfo.getProjectName();
|
||||
String unitName = sltAgreementInfo.getUnitName();
|
||||
BigDecimal totalCost = BigDecimal.valueOf(0.00);
|
||||
List<SltAgreementInfo> sltAgreementInfo = JSONObject.parseArray(params,SltAgreementInfo.class);
|
||||
List<String> projectNames = new ArrayList<>();
|
||||
List<String> unitNames = new ArrayList<>();
|
||||
List<SltAgreementInfo> leaseList = new ArrayList<>();
|
||||
|
||||
List<SltAgreementInfo> oneOfList = sltAgreementInfoMapper.getLeaseList(sltAgreementInfo);
|
||||
String fileName = "租赁费用明细表";
|
||||
for (SltAgreementInfo info : sltAgreementInfo) {
|
||||
projectNames.add(info.getProjectName());
|
||||
unitNames.add(info.getUnitName());
|
||||
List<SltAgreementInfo> oneOfList = sltAgreementInfoMapper.getLeaseList(info);
|
||||
leaseList.addAll(oneOfList);
|
||||
}
|
||||
String projectName = handleData(projectNames);
|
||||
String unitName = handleData(unitNames);
|
||||
BigDecimal totalCost = BigDecimal.valueOf(0.00);
|
||||
for (SltAgreementInfo bean : leaseList) {
|
||||
if (null == bean.getLeasePrice()) {
|
||||
bean.setLeasePrice(BigDecimal.valueOf(0.00));
|
||||
|
|
@ -667,6 +724,7 @@ public class SltAgreementInfoController extends BaseController {
|
|||
@PostMapping("/exportRepair")
|
||||
public void exportRepair(HttpServletResponse response,SltAgreementInfo sltAgreementInfo) {
|
||||
try {
|
||||
|
||||
String fileName = "维修费用明细表";
|
||||
String projectName = sltAgreementInfo.getProjectName();
|
||||
String unitName = sltAgreementInfo.getUnitName();
|
||||
|
|
|
|||
Loading…
Reference in New Issue