包头月报周报bug修复
This commit is contained in:
parent
7b1ed8a26a
commit
8e03f217d7
@ -1,53 +1,29 @@
|
||||
package com.zhgd.xmgl.modules.baotou.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.zhgd.annotation.OperLog;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import java.util.HashMap;
|
||||
import springfox.documentation.annotations.ApiIgnore;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLDecoder;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import com.zhgd.jeecg.common.api.vo.Result;
|
||||
import com.zhgd.jeecg.common.system.query.QueryGenerator;
|
||||
import com.zhgd.jeecg.common.util.oConvertUtils;
|
||||
import org.apache.commons.collections.MapUtils;
|
||||
import com.zhgd.xmgl.modules.baotou.entity.ContractorMonthlyPeriod;
|
||||
import com.zhgd.xmgl.modules.baotou.service.IContractorMonthlyPeriodService;
|
||||
|
||||
import org.simpleframework.xml.core.Validate;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import org.jeecgframework.poi.excel.ExcelImportUtil;
|
||||
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
|
||||
import org.jeecgframework.poi.excel.entity.ExportParams;
|
||||
import org.jeecgframework.poi.excel.entity.ImportParams;
|
||||
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
|
||||
|
||||
import org.simpleframework.xml.core.Validate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import springfox.documentation.annotations.ApiIgnore;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* @Title: Controller
|
||||
* @Description: 承包商项自组月报周报计划(word和excel版)
|
||||
* @author: pds
|
||||
* @date: 2024-11-21
|
||||
* @date: 2024-11-21
|
||||
* @version: V1.0
|
||||
*/
|
||||
@RestController
|
||||
@ -55,85 +31,94 @@ import com.alibaba.fastjson.JSON;
|
||||
@Slf4j
|
||||
@Api(tags = "承包商项自组月报周报计划(word和excel版)相关Api")
|
||||
public class ContractorMonthlyPeriodController {
|
||||
@Autowired
|
||||
private IContractorMonthlyPeriodService contractorMonthlyPeriodService;
|
||||
@Autowired
|
||||
private IContractorMonthlyPeriodService contractorMonthlyPeriodService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
* @return
|
||||
*/
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@OperLog(operModul = "承包商项自组月报周报计划(word和excel版)管理", operType = "分页查询", operDesc = "分页列表查询承包商项自组月报周报计划(word和excel版)信息")
|
||||
@ApiOperation(value = "分页列表查询承包商项自组月报周报计划(word和excel版)信息", notes = "分页列表查询承包商项自组月报周报计划(word和excel版)信息", httpMethod="GET")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "pageNo", value = "第几页", paramType = "query", required = true, dataType = "Integer"),
|
||||
@ApiImplicitParam(name = "pageSize", value = "每页显示条数", paramType = "query", required = true, dataType = "Integer"),
|
||||
})
|
||||
@GetMapping(value = "/page")
|
||||
public Result<IPage<ContractorMonthlyPeriod>> queryPageList(@ApiIgnore @RequestParam HashMap<String, Object> param) {
|
||||
return Result.success(contractorMonthlyPeriodService.queryPageList(param));
|
||||
}
|
||||
@ApiOperation(value = "分页列表查询承包商项自组月报周报计划(word和excel版)信息", notes = "分页列表查询承包商项自组月报周报计划(word和excel版)信息", httpMethod = "GET")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "pageNo", value = "第几页", paramType = "query", required = true, dataType = "Integer"),
|
||||
@ApiImplicitParam(name = "pageSize", value = "每页显示条数", paramType = "query", required = true, dataType = "Integer"),
|
||||
})
|
||||
@GetMapping(value = "/page")
|
||||
public Result<IPage<ContractorMonthlyPeriod>> queryPageList(@ApiIgnore @RequestParam HashMap<String, Object> param) {
|
||||
return Result.success(contractorMonthlyPeriodService.queryPageList(param));
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
* @return
|
||||
*/
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@OperLog(operModul = "承包商项自组月报周报计划(word和excel版)管理", operType = "列表查询", operDesc = "列表查询承包商项自组月报周报计划(word和excel版)信息")
|
||||
@ApiOperation(value = "列表查询承包商项自组月报周报计划(word和excel版)信息", notes = "列表查询承包商项自组月报周报计划(word和excel版)信息", httpMethod="GET")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<List<ContractorMonthlyPeriod>> queryList(@ApiIgnore @RequestParam HashMap<String, Object> param) {
|
||||
return Result.success(contractorMonthlyPeriodService.queryList(param));
|
||||
}
|
||||
@ApiOperation(value = "列表查询承包商项自组月报周报计划(word和excel版)信息", notes = "列表查询承包商项自组月报周报计划(word和excel版)信息", httpMethod = "GET")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<List<ContractorMonthlyPeriod>> queryList(@ApiIgnore @RequestParam HashMap<String, Object> param) {
|
||||
return Result.success(contractorMonthlyPeriodService.queryList(param));
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
* @param contractorMonthlyPeriod
|
||||
* @return
|
||||
*/
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param contractorMonthlyPeriod
|
||||
* @return
|
||||
*/
|
||||
@OperLog(operModul = "承包商项自组月报周报计划(word和excel版)管理", operType = "添加", operDesc = "添加承包商项自组月报周报计划(word和excel版)信息")
|
||||
@ApiOperation(value = "添加承包商项自组月报周报计划(word和excel版)信息", notes = "添加承包商项自组月报周报计划(word和excel版)信息" , httpMethod="POST")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<ContractorMonthlyPeriod> add(@RequestBody @Validate ContractorMonthlyPeriod contractorMonthlyPeriod) {
|
||||
contractorMonthlyPeriodService.add(contractorMonthlyPeriod);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* @param contractorMonthlyPeriod
|
||||
* @return
|
||||
*/
|
||||
@OperLog(operModul = "承包商项自组月报周报计划(word和excel版)管理", operType = "编辑", operDesc = "编辑承包商项自组月报周报计划(word和excel版)信息")
|
||||
@ApiOperation(value = "编辑承包商项自组月报周报计划(word和excel版)信息", notes = "编辑承包商项自组月报周报计划(word和excel版)信息" , httpMethod="POST")
|
||||
@PostMapping(value = "/edit")
|
||||
public Result<ContractorMonthlyPeriod> edit(@RequestBody ContractorMonthlyPeriod contractorMonthlyPeriod) {
|
||||
contractorMonthlyPeriodService.edit(contractorMonthlyPeriod);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
* @return
|
||||
*/
|
||||
@OperLog(operModul = "承包商项自组月报周报计划(word和excel版)管理", operType = "删除", operDesc = "删除承包商项自组月报周报计划(word和excel版)信息")
|
||||
@ApiOperation(value = "删除承包商项自组月报周报计划(word和excel版)信息", notes = "删除承包商项自组月报周报计划(word和excel版)信息" , httpMethod="POST")
|
||||
@ApiImplicitParam(name = "id", value = "承包商项自组月报周报计划(word和excel版)ID", paramType = "body", required = true, dataType = "String", example = "{\"id\":\"1\"}")
|
||||
@PostMapping(value = "/delete")
|
||||
public Result<ContractorMonthlyPeriod> delete(@ApiIgnore @RequestBody HashMap<String ,Object> map) {
|
||||
contractorMonthlyPeriodService.delete(MapUtils.getString(map, "id"));
|
||||
@ApiOperation(value = "添加承包商项自组月报周报计划(word和excel版)信息", notes = "添加承包商项自组月报周报计划(word和excel版)信息", httpMethod = "POST")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<ContractorMonthlyPeriod> add(@RequestBody @Validate ContractorMonthlyPeriod contractorMonthlyPeriod) {
|
||||
contractorMonthlyPeriodService.add(contractorMonthlyPeriod);
|
||||
return Result.ok();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param contractorMonthlyPeriod
|
||||
* @return
|
||||
*/
|
||||
@OperLog(operModul = "承包商项自组月报周报计划(word和excel版)管理", operType = "编辑", operDesc = "编辑承包商项自组月报周报计划(word和excel版)信息")
|
||||
@ApiOperation(value = "编辑承包商项自组月报周报计划(word和excel版)信息", notes = "编辑承包商项自组月报周报计划(word和excel版)信息", httpMethod = "POST")
|
||||
@PostMapping(value = "/edit")
|
||||
public Result<ContractorMonthlyPeriod> edit(@RequestBody ContractorMonthlyPeriod contractorMonthlyPeriod) {
|
||||
contractorMonthlyPeriodService.edit(contractorMonthlyPeriod);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@OperLog(operModul = "承包商项自组月报周报计划(word和excel版)管理", operType = "删除", operDesc = "删除承包商项自组月报周报计划(word和excel版)信息")
|
||||
@ApiOperation(value = "删除承包商项自组月报周报计划(word和excel版)信息", notes = "删除承包商项自组月报周报计划(word和excel版)信息", httpMethod = "POST")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "承包商项自组月报周报计划(word和excel版)ID", paramType = "body", required = true, dataType = "String", example = "{\"id\":\"1\"}"),
|
||||
@ApiImplicitParam(name = "isAll", value = "1项目组的工程量选择全部装置", paramType = "body", required = true, dataType = "Integer")
|
||||
})
|
||||
@PostMapping(value = "/delete")
|
||||
public Result<ContractorMonthlyPeriod> delete(@ApiIgnore @RequestBody HashMap<String, Object> map) {
|
||||
contractorMonthlyPeriodService.delete(map);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@OperLog(operModul = "承包商项自组月报周报计划(word和excel版)管理", operType = "通过id查询", operDesc = "通过id查询承包商项自组月报周报计划(word和excel版)信息")
|
||||
@ApiOperation(value = "通过id查询承包商项自组月报周报计划(word和excel版)信息", notes = "通过id查询承包商项自组月报周报计划(word和excel版)信息" , httpMethod="GET")
|
||||
@ApiImplicitParam(name = "id", value = "承包商项自组月报周报计划(word和excel版)ID", paramType = "query", required = true, dataType = "Integer")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<ContractorMonthlyPeriod> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
return Result.success(contractorMonthlyPeriodService.queryById(id));
|
||||
}
|
||||
@ApiOperation(value = "通过id查询承包商项自组月报周报计划(word和excel版)信息", notes = "通过id查询承包商项自组月报周报计划(word和excel版)信息", httpMethod = "GET")
|
||||
@ApiImplicitParam(name = "id", value = "承包商项自组月报周报计划(word和excel版)ID", paramType = "query", required = true, dataType = "Integer")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<ContractorMonthlyPeriod> queryById(@RequestParam(name = "id", required = true) String id) {
|
||||
return Result.success(contractorMonthlyPeriodService.queryById(id));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,60 +1,71 @@
|
||||
package com.zhgd.xmgl.modules.baotou.service;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.zhgd.xmgl.modules.baotou.entity.ContractorMonthlyPeriod;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.zhgd.xmgl.modules.baotou.entity.ContractorMonthlyPeriod;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @Description: 承包商项自组月报周报计划(word和excel版)
|
||||
* @author: pds
|
||||
* @date: 2024-11-21
|
||||
* @date: 2024-11-21
|
||||
* @version: V1.0
|
||||
*/
|
||||
public interface IContractorMonthlyPeriodService extends IService<ContractorMonthlyPeriod> {
|
||||
/**
|
||||
* 分页列表查询承包商项自组月报周报计划(word和excel版)信息
|
||||
*
|
||||
* @param param 参数map
|
||||
* @return
|
||||
*/
|
||||
IPage<ContractorMonthlyPeriod> queryPageList(HashMap<String, Object> param);
|
||||
|
||||
/**
|
||||
* 列表查询承包商项自组月报周报计划(word和excel版)信息
|
||||
*
|
||||
* @param param 参数map
|
||||
* @return
|
||||
*/
|
||||
List<ContractorMonthlyPeriod> queryList(HashMap<String, Object> param);
|
||||
|
||||
/**
|
||||
* 添加承包商项自组月报周报计划(word和excel版)信息
|
||||
*
|
||||
* @param contractorMonthlyPeriod 承包商项自组月报周报计划(word和excel版)
|
||||
* @return
|
||||
*/
|
||||
void add(ContractorMonthlyPeriod contractorMonthlyPeriod);
|
||||
|
||||
/**
|
||||
* 编辑承包商项自组月报周报计划(word和excel版)信息
|
||||
*
|
||||
* @param contractorMonthlyPeriod 承包商项自组月报周报计划(word和excel版)
|
||||
* @return
|
||||
*/
|
||||
void edit(ContractorMonthlyPeriod contractorMonthlyPeriod);
|
||||
|
||||
/**
|
||||
* 根据id删除承包商项自组月报周报计划(word和excel版)信息
|
||||
* @param id 承包商项自组月报周报计划(word和excel版)的id
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
void delete(String id);
|
||||
void delete(HashMap<String, Object> map);
|
||||
|
||||
/**
|
||||
* 根据id查询承包商项自组月报周报计划(word和excel版)信息
|
||||
*
|
||||
* @param id 承包商项自组月报周报计划(word和excel版)的id
|
||||
* @return
|
||||
*/
|
||||
ContractorMonthlyPeriod queryById(String id);
|
||||
|
||||
ContractorMonthlyPeriod queryByEntity(ContractorMonthlyPeriod period);
|
||||
|
||||
ContractorMonthlyPeriod getNextPeriod(ContractorMonthlyPeriod p);
|
||||
|
||||
|
||||
ContractorMonthlyPeriod getBeforePeriod(ContractorMonthlyPeriod p);
|
||||
|
||||
}
|
||||
|
||||
@ -16,7 +16,6 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.gexin.fastjson.JSON;
|
||||
import com.gexin.fastjson.JSONArray;
|
||||
import com.gexin.fastjson.JSONObject;
|
||||
import com.gexin.fastjson.TypeReference;
|
||||
import com.zhgd.jeecg.common.execption.OpenAlertException;
|
||||
import com.zhgd.jeecg.common.system.query.QueryGenerator;
|
||||
import com.zhgd.xmgl.modules.baotou.entity.*;
|
||||
@ -661,7 +660,12 @@ public class ContractorMonthlyDetailServiceImpl extends ServiceImpl<ContractorMo
|
||||
Integer levelType = MapUtils.getInteger(param, "levelType");
|
||||
Integer type = MapUtils.getInteger(param, "type");
|
||||
Long groupId = period.getGroupId();
|
||||
Long deviceId = period.getDeviceId();
|
||||
Long deviceId = null;
|
||||
if (period.getType() == 2 && (contentType == 5 || contentType == 6)) {
|
||||
deviceId = MapUtils.getLong(param, "deviceId");
|
||||
} else {
|
||||
deviceId = period.getDeviceId();
|
||||
}
|
||||
Long enterpriseId = MapUtils.getLong(param, "enterpriseId");
|
||||
DeviceUnit unit = deviceUnitService.getById(deviceId);
|
||||
ProjectGroup group = projectGroupService.getById(groupId);
|
||||
@ -687,7 +691,7 @@ public class ContractorMonthlyDetailServiceImpl extends ServiceImpl<ContractorMo
|
||||
tempType = 7;
|
||||
} else if (contentType == 6 && levelType == 2) {
|
||||
tempType = 8;
|
||||
} else if (contentType == 8){
|
||||
} else if (contentType == 8) {
|
||||
//项目计划
|
||||
tempType = 14;
|
||||
}
|
||||
@ -825,19 +829,18 @@ public class ContractorMonthlyDetailServiceImpl extends ServiceImpl<ContractorMo
|
||||
}
|
||||
}
|
||||
//设计总量
|
||||
ContractorMonthlyDesign design = contractorMonthlyDesignService.getOne(new LambdaQueryWrapper<ContractorMonthlyDesign>()
|
||||
.eq(ContractorMonthlyDesign::getDeviceId, deviceId)
|
||||
List<ContractorMonthlyDesign> designs = contractorMonthlyDesignService.list(new LambdaQueryWrapper<ContractorMonthlyDesign>()
|
||||
.eq(deviceId != null, ContractorMonthlyDesign::getDeviceId, deviceId)
|
||||
.eq(ContractorMonthlyDesign::getDesignType, designType)
|
||||
.eq(ContractorMonthlyDesign::getType, contentType == 5 ? 1 : 2)
|
||||
);
|
||||
if (design != null) {
|
||||
List<String> list = JSON.parseObject(design.getQuantity(), new TypeReference<List<String>>() {
|
||||
});
|
||||
SheetUtils.setColDataListForQuantity(toCellDataJo, 3, "C", list, greens);
|
||||
if (designs != null) {
|
||||
List<String> list1 = designs.stream().map(ContractorMonthlyDesign::getQuantity).collect(Collectors.toList());
|
||||
SheetUtils.setColDataListForQuantity(toCellDataJo, 3, "C", this.sumListJson(list1), greens);
|
||||
}
|
||||
//查询所有的period
|
||||
List<ContractorMonthlyPeriod> periodList = contractorMonthlyPeriodService.list(new LambdaQueryWrapper<ContractorMonthlyPeriod>()
|
||||
.eq(ContractorMonthlyPeriod::getDeviceId, deviceId)
|
||||
.eq(deviceId != null, ContractorMonthlyPeriod::getDeviceId, deviceId)
|
||||
.eq(ContractorMonthlyPeriod::getGroupId, groupId)
|
||||
.eq(ContractorMonthlyPeriod::getType, type)
|
||||
.eq(type == 1, ContractorMonthlyPeriod::getEnterpriseId, enterpriseId)
|
||||
@ -853,10 +856,12 @@ public class ContractorMonthlyDetailServiceImpl extends ServiceImpl<ContractorMo
|
||||
int year = thisP.getYear();
|
||||
int whichWeek = thisP.getWhichWeek();
|
||||
ContractorMonthlyQuantity quantity = op.get();
|
||||
List<Long> pids0 = periodList.stream().filter(o -> isEqual(o, year, month, whichWeek)).map(ContractorMonthlyPeriod::getId).collect(Collectors.toList());
|
||||
List<String> wmQuantitys = quantityList.stream().filter(o -> pids0.contains(o.getPeriodId())).map(ContractorMonthlyQuantity::getWeekQuantity).collect(Collectors.toList());
|
||||
List<String> remarks = quantityList.stream().filter(o -> pids0.contains(o.getPeriodId())).map(ContractorMonthlyQuantity::getRemarks).collect(Collectors.toList());
|
||||
//周/月
|
||||
SheetUtils.setColDataListForQuantity(toCellDataJo, 3, "D", this.sumListJson(wmQuantitys), greens);
|
||||
if (levelType == 2) {
|
||||
//周
|
||||
String wmQuantity = quantity.getWeekQuantity();
|
||||
SheetUtils.setColDataListForQuantity(toCellDataJo, 3, "D", wmQuantity, greens);
|
||||
//本月完成量
|
||||
List<Long> pids1 = periodList.stream().filter(o -> isLessOrEqual(o, year, month, whichWeek)).map(ContractorMonthlyPeriod::getId).collect(Collectors.toList());
|
||||
List<String> months = quantityList.stream().filter(o -> pids1.contains(o.getPeriodId())).map(ContractorMonthlyQuantity::getWeekQuantity).collect(Collectors.toList());
|
||||
@ -869,18 +874,14 @@ public class ContractorMonthlyDetailServiceImpl extends ServiceImpl<ContractorMo
|
||||
List<String> alls = quantityList.stream().map(ContractorMonthlyQuantity::getWeekQuantity).collect(Collectors.toList());
|
||||
SheetUtils.setColDataListForQuantity(toCellDataJo, 3, "G", this.sumListJson(alls), greens);
|
||||
//本期到货
|
||||
String arriveGoods = quantity.getArriveGoods();
|
||||
SheetUtils.setColDataListForQuantity(toCellDataJo, 3, "H", arriveGoods, greens);
|
||||
List<String> arriveGoods = quantityList.stream().filter(o -> pids0.contains(o.getPeriodId())).map(ContractorMonthlyQuantity::getArriveGoods).collect(Collectors.toList());
|
||||
SheetUtils.setColDataListForQuantity(toCellDataJo, 3, "H", this.sumListJson(arriveGoods), greens);
|
||||
//累计到货
|
||||
List<String> arriveAlls = quantityList.stream().map(ContractorMonthlyQuantity::getArriveGoods).collect(Collectors.toList());
|
||||
SheetUtils.setColDataListForQuantity(toCellDataJo, 3, "I", this.sumListJson(arriveAlls), greens);
|
||||
//备注
|
||||
String remarks = quantity.getRemarks();
|
||||
SheetUtils.setColDataListForQuantity(toCellDataJo, 3, "J", remarks, greens);
|
||||
SheetUtils.setColDataListForQuantity(toCellDataJo, 3, "J", this.splitListJson(remarks), greens);
|
||||
} else {
|
||||
//月
|
||||
//本月完成量
|
||||
SheetUtils.setColDataListForQuantity(toCellDataJo, 3, "D", quantity.getMonthQuantity(), greens);
|
||||
//本年累计完成量
|
||||
List<Long> pids2 = periodList.stream().filter(o -> isLessOrEqual(o, year, month, whichWeek)).map(ContractorMonthlyPeriod::getId).collect(Collectors.toList());
|
||||
List<String> years = quantityList.stream().filter(o -> pids2.contains(o.getPeriodId())).map(ContractorMonthlyQuantity::getMonthQuantity).collect(Collectors.toList());
|
||||
@ -889,14 +890,13 @@ public class ContractorMonthlyDetailServiceImpl extends ServiceImpl<ContractorMo
|
||||
List<String> alls = quantityList.stream().map(ContractorMonthlyQuantity::getMonthQuantity).collect(Collectors.toList());
|
||||
SheetUtils.setColDataListForQuantity(toCellDataJo, 3, "F", this.sumListJson(alls), greens);
|
||||
//本期到货
|
||||
String arriveGoods = quantity.getArriveGoods();
|
||||
SheetUtils.setColDataListForQuantity(toCellDataJo, 3, "G", arriveGoods, greens);
|
||||
List<String> arriveGoods = quantityList.stream().filter(o -> pids0.contains(o.getPeriodId())).map(ContractorMonthlyQuantity::getArriveGoods).collect(Collectors.toList());
|
||||
SheetUtils.setColDataListForQuantity(toCellDataJo, 3, "G", this.sumListJson(arriveGoods), greens);
|
||||
//累计到货
|
||||
List<String> arriveAlls = quantityList.stream().map(ContractorMonthlyQuantity::getArriveGoods).collect(Collectors.toList());
|
||||
SheetUtils.setColDataListForQuantity(toCellDataJo, 3, "H", this.sumListJson(arriveAlls), greens);
|
||||
//备注
|
||||
String remarks = quantity.getRemarks();
|
||||
SheetUtils.setColDataListForQuantity(toCellDataJo, 3, "I", remarks, greens);
|
||||
SheetUtils.setColDataListForQuantity(toCellDataJo, 3, "I", this.splitListJson(remarks), greens);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -911,6 +911,9 @@ public class ContractorMonthlyDetailServiceImpl extends ServiceImpl<ContractorMo
|
||||
return NumberUtil.isLessOrEqual(NumberUtil.add(o.getYear() * 1000, o.getMonth() * 10, o.getWhichWeek()), NumberUtil.add(finalYear * 1000, finalMonth * 10, finalWhichWeek));
|
||||
}
|
||||
|
||||
private boolean isEqual(ContractorMonthlyPeriod o, Integer finalYear, Integer finalMonth, Integer finalWhichWeek) {
|
||||
return NumberUtil.equals(NumberUtil.add(o.getYear() * 1000, o.getMonth() * 10, o.getWhichWeek()), NumberUtil.add(finalYear * 1000, finalMonth * 10, finalWhichWeek));
|
||||
}
|
||||
|
||||
private List<String> sumListJson(List<String> months) {
|
||||
List<BigDecimal> monthList = new ArrayList<>();
|
||||
@ -920,8 +923,9 @@ public class ContractorMonthlyDetailServiceImpl extends ServiceImpl<ContractorMo
|
||||
if (monthList.size() < i + 1) {
|
||||
monthList.add(new BigDecimal("0"));
|
||||
}
|
||||
BigDecimal d = array.getBigDecimal(i);
|
||||
monthList.add(i, NumberUtil.add(monthList.get(i), d));
|
||||
String d = array.getString(i);
|
||||
BigDecimal r = NumberUtil.add(monthList.get(i), Convert.toBigDecimal(d));
|
||||
monthList.set(i, r);
|
||||
}
|
||||
}
|
||||
List<String> list = monthList.stream().map(o -> o.toString()).collect(Collectors.toList());
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package com.zhgd.xmgl.modules.baotou.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
@ -8,7 +9,6 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.zhgd.jeecg.common.execption.OpenAlertException;
|
||||
import com.zhgd.jeecg.common.system.query.QueryGenerator;
|
||||
import com.zhgd.xmgl.modules.baotou.entity.ContractorMonthlyDesign;
|
||||
import com.zhgd.xmgl.modules.baotou.entity.ContractorMonthlyDetail;
|
||||
import com.zhgd.xmgl.modules.baotou.entity.ContractorMonthlyPeriod;
|
||||
import com.zhgd.xmgl.modules.baotou.entity.ContractorMonthlyQuantity;
|
||||
@ -19,9 +19,12 @@ import com.zhgd.xmgl.modules.baotou.service.IContractorMonthlyPeriodService;
|
||||
import com.zhgd.xmgl.modules.baotou.service.IContractorMonthlyQuantityService;
|
||||
import com.zhgd.xmgl.util.PageUtil;
|
||||
import com.zhgd.xmgl.util.RefUtil;
|
||||
import org.apache.commons.collections.MapUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
@ -33,6 +36,7 @@ import java.util.Objects;
|
||||
* @version: V1.0
|
||||
*/
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class ContractorMonthlyPeriodServiceImpl extends ServiceImpl<ContractorMonthlyPeriodMapper, ContractorMonthlyPeriod> implements IContractorMonthlyPeriodService {
|
||||
@Autowired
|
||||
private ContractorMonthlyPeriodMapper contractorMonthlyPeriodMapper;
|
||||
@ -60,6 +64,11 @@ public class ContractorMonthlyPeriodServiceImpl extends ServiceImpl<ContractorMo
|
||||
|
||||
private QueryWrapper<ContractorMonthlyPeriod> getQueryWrapper(HashMap<String, Object> param) {
|
||||
QueryWrapper<ContractorMonthlyPeriod> queryWrapper = QueryGenerator.initPageQueryWrapper(ContractorMonthlyPeriod.class, param, true);
|
||||
String deviceId = MapUtils.getString(param, "deviceId");
|
||||
String type = MapUtils.getString(param, "type");
|
||||
if (StrUtil.isBlank(deviceId) && Objects.equals(type,"2")) {
|
||||
queryWrapper.groupBy(RefUtil.fieldNameUlc(ContractorMonthlyPeriod::getYear), RefUtil.fieldNameUlc(ContractorMonthlyPeriod::getMonth), RefUtil.fieldNameUlc(ContractorMonthlyPeriod::getWhichWeek));
|
||||
}
|
||||
queryWrapper.orderByDesc(RefUtil.fieldNameUlc(ContractorMonthlyPeriod::getYear), RefUtil.fieldNameUlc(ContractorMonthlyPeriod::getMonth), RefUtil.fieldNameUlc(ContractorMonthlyPeriod::getWhichWeek));
|
||||
return queryWrapper;
|
||||
}
|
||||
@ -99,17 +108,35 @@ public class ContractorMonthlyPeriodServiceImpl extends ServiceImpl<ContractorMo
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(String id) {
|
||||
ContractorMonthlyPeriod contractorMonthlyPeriod = baseMapper.selectById(id);
|
||||
if (contractorMonthlyPeriod == null) {
|
||||
public void delete(HashMap<String, Object> map) {
|
||||
String id = MapUtils.getString(map, "id");
|
||||
ContractorMonthlyPeriod period = baseMapper.selectById(id);
|
||||
if (period == null) {
|
||||
throw new OpenAlertException("未找到对应实体");
|
||||
}
|
||||
baseMapper.deleteById(id);
|
||||
|
||||
contractorMonthlyDetailService.remove(new LambdaQueryWrapper<ContractorMonthlyDetail>()
|
||||
.eq(ContractorMonthlyDetail::getPeriodId, id));
|
||||
contractorMonthlyQuantityService.remove(new LambdaQueryWrapper<ContractorMonthlyQuantity>()
|
||||
.eq(ContractorMonthlyQuantity::getPeriodId, id));
|
||||
Integer isAll = MapUtils.getInteger(map, "isAll");
|
||||
List<ContractorMonthlyPeriod> periods = new ArrayList<>();
|
||||
if (Objects.equals(isAll, 1)) {
|
||||
periods = contractorMonthlyPeriodMapper.selectList(new LambdaQueryWrapper<ContractorMonthlyPeriod>()
|
||||
.eq(ContractorMonthlyPeriod::getGroupId, period.getGroupId())
|
||||
.eq(ContractorMonthlyPeriod::getType, period.getType())
|
||||
.eq(ContractorMonthlyPeriod::getYear, period.getYear())
|
||||
.eq(ContractorMonthlyPeriod::getMonth, period.getMonth())
|
||||
.eq(ContractorMonthlyPeriod::getWhichWeek, period.getWhichWeek())
|
||||
.eq(ContractorMonthlyPeriod::getLevelType, period.getLevelType())
|
||||
.eq(ContractorMonthlyPeriod::getProjectSn, period.getProjectSn())
|
||||
);
|
||||
} else {
|
||||
periods.add(period);
|
||||
}
|
||||
for (ContractorMonthlyPeriod monthlyPeriod : periods) {
|
||||
id = String.valueOf(monthlyPeriod.getId());
|
||||
baseMapper.deleteById(id);
|
||||
contractorMonthlyDetailService.remove(new LambdaQueryWrapper<ContractorMonthlyDetail>()
|
||||
.eq(ContractorMonthlyDetail::getPeriodId, id));
|
||||
contractorMonthlyQuantityService.remove(new LambdaQueryWrapper<ContractorMonthlyQuantity>()
|
||||
.eq(ContractorMonthlyQuantity::getPeriodId, id));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -187,5 +214,4 @@ public class ContractorMonthlyPeriodServiceImpl extends ServiceImpl<ContractorMo
|
||||
return p1;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user