包头bug修复

This commit is contained in:
guoshengxiong 2024-11-25 21:10:21 +08:00
parent b1971466a6
commit 7abc221575
17 changed files with 603 additions and 401 deletions

View File

@ -213,9 +213,9 @@ public class OperLogAspect {
BeanUtil.copyProperties(ReflectUtil.invoke(mapperObj, selectIdMethod, idField.get(obj)), obj);
}
}
Pair<String, String> changePair = getBeforeAndAfterDataChange(beforeList, afterList);
operlog.setDataChangeBefore(changePair.getLeft());
operlog.setDataChangeAfter(changePair.getRight());
// Pair<String, String> changePair = getBeforeAndAfterDataChange(beforeList, afterList);
// operlog.setDataChangeBefore(changePair.getLeft());
// operlog.setDataChangeAfter(changePair.getRight());
}
} catch (Exception e) {
log.error("处理前后数据异常", e);

View File

@ -147,6 +147,7 @@ public class ContractorMonthlyDetailController {
@ApiImplicitParam(name = "hasDefault", value = "1有默认值", paramType = "query", required = true, dataType = "Integer"),
@ApiImplicitParam(name = "levelType", value = "时间级别1月2周", paramType = "query", required = true, dataType = "Integer"),
@ApiImplicitParam(name = "groupId", value = "项目组id", paramType = "query", required = true, dataType = "Integer"),
@ApiImplicitParam(name = "deviceId", value = "设备id", paramType = "query", required = true, dataType = "Integer"),
})
@GetMapping(value = "/queryContractorMonthlyDetailInfo")
public Result<String> queryDetail(@ApiIgnore @RequestParam HashMap<String, Object> param, HttpServletRequest request) {

View File

@ -1,49 +1,26 @@
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.ProjectHomeCarousel;
import com.zhgd.xmgl.modules.baotou.service.IProjectHomeCarouselService;
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.apache.commons.collections.MapUtils;
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: 首页轮播图
* @author pds
@ -60,10 +37,11 @@ public class ProjectHomeCarouselController {
/**
* 分页列表查询
*
* @return
*/
@OperLog(operModul = "首页轮播图管理", operType = "分页查询", operDesc = "分页列表查询首页轮播图信息")
@ApiOperation(value = "分页列表查询首页轮播图信息", notes = "分页列表查询首页轮播图信息", httpMethod="GET")
@ApiOperation(value = "分页列表查询首页轮播图信息", notes = "分页列表查询首页轮播图信息", httpMethod = "GET")
@ApiImplicitParams({
@ApiImplicitParam(name = "pageNo", value = "第几页", paramType = "query", required = true, dataType = "Integer"),
@ApiImplicitParam(name = "pageSize", value = "每页显示条数", paramType = "query", required = true, dataType = "Integer"),
@ -75,10 +53,11 @@ public class ProjectHomeCarouselController {
/**
* 列表查询
*
* @return
*/
@OperLog(operModul = "首页轮播图管理", operType = "列表查询", operDesc = "列表查询首页轮播图信息")
@ApiOperation(value = "列表查询首页轮播图信息", notes = "列表查询首页轮播图信息", httpMethod="GET")
@ApiOperation(value = "列表查询首页轮播图信息", notes = "列表查询首页轮播图信息", httpMethod = "GET")
@GetMapping(value = "/list")
public Result<List<ProjectHomeCarousel>> queryList(@ApiIgnore @RequestParam HashMap<String, Object> param) {
return Result.success(projectHomeCarouselService.queryList(param));
@ -86,24 +65,34 @@ public class ProjectHomeCarouselController {
/**
* 添加
*
* @param projectHomeCarousel
* @return
*/
@OperLog(operModul = "首页轮播图管理", operType = "添加", operDesc = "添加首页轮播图信息")
@ApiOperation(value = "添加首页轮播图信息", notes = "添加首页轮播图信息" , httpMethod="POST")
@ApiOperation(value = "添加首页轮播图信息", notes = "添加首页轮播图信息", httpMethod = "POST")
@PostMapping(value = "/add")
public Result<ProjectHomeCarousel> add(@RequestBody @Validate ProjectHomeCarousel projectHomeCarousel) {
projectHomeCarouselService.add(projectHomeCarousel);
return Result.ok();
}
@OperLog(operModul = "首页轮播图管理", operType = "", operDesc = "保存首页轮播图信息")
@ApiOperation(value = "保存首页轮播图信息", notes = "保存首页轮播图信息", httpMethod = "POST")
@PostMapping(value = "/save")
public Result<ProjectHomeCarousel> saveAll(@RequestBody @Validate HashMap<String ,Object> param) {
projectHomeCarouselService.saveAll(param);
return Result.ok();
}
/**
* 编辑
*
* @param projectHomeCarousel
* @return
*/
@OperLog(operModul = "首页轮播图管理", operType = "编辑", operDesc = "编辑首页轮播图信息")
@ApiOperation(value = "编辑首页轮播图信息", notes = "编辑首页轮播图信息" , httpMethod="POST")
@ApiOperation(value = "编辑首页轮播图信息", notes = "编辑首页轮播图信息", httpMethod = "POST")
@PostMapping(value = "/edit")
public Result<ProjectHomeCarousel> edit(@RequestBody ProjectHomeCarousel projectHomeCarousel) {
projectHomeCarouselService.edit(projectHomeCarousel);
@ -112,27 +101,29 @@ public class ProjectHomeCarouselController {
/**
* 通过id删除
*
* @return
*/
@OperLog(operModul = "首页轮播图管理", operType = "删除", operDesc = "删除首页轮播图信息")
@ApiOperation(value = "删除首页轮播图信息", notes = "删除首页轮播图信息" , httpMethod="POST")
@ApiOperation(value = "删除首页轮播图信息", notes = "删除首页轮播图信息", httpMethod = "POST")
@ApiImplicitParam(name = "id", value = "首页轮播图ID", paramType = "body", required = true, dataType = "String", example = "{\"id\":\"1\"}")
@PostMapping(value = "/delete")
public Result<ProjectHomeCarousel> delete(@ApiIgnore @RequestBody HashMap<String ,Object> map) {
public Result<ProjectHomeCarousel> delete(@ApiIgnore @RequestBody HashMap<String, Object> map) {
projectHomeCarouselService.delete(MapUtils.getString(map, "id"));
return Result.ok();
}
/**
* 通过id查询
*
* @param id
* @return
*/
@OperLog(operModul = "首页轮播图管理", operType = "通过id查询", operDesc = "通过id查询首页轮播图信息")
@ApiOperation(value = "通过id查询首页轮播图信息", notes = "通过id查询首页轮播图信息" , httpMethod="GET")
@ApiOperation(value = "通过id查询首页轮播图信息", notes = "通过id查询首页轮播图信息", httpMethod = "GET")
@ApiImplicitParam(name = "id", value = "首页轮播图ID", paramType = "query", required = true, dataType = "Integer")
@GetMapping(value = "/queryById")
public Result<ProjectHomeCarousel> queryById(@RequestParam(name="id",required=true) String id) {
public Result<ProjectHomeCarousel> queryById(@RequestParam(name = "id", required = true) String id) {
return Result.success(projectHomeCarouselService.queryById(id));
}

View File

@ -1,49 +1,26 @@
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.ProjectHomeName;
import com.zhgd.xmgl.modules.baotou.service.IProjectHomeNameService;
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.apache.commons.collections.MapUtils;
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: 首页名称
* @author pds
@ -60,10 +37,11 @@ public class ProjectHomeNameController {
/**
* 分页列表查询
*
* @return
*/
@OperLog(operModul = "首页名称管理", operType = "分页查询", operDesc = "分页列表查询首页名称信息")
@ApiOperation(value = "分页列表查询首页名称信息", notes = "分页列表查询首页名称信息", httpMethod="GET")
@ApiOperation(value = "分页列表查询首页名称信息", notes = "分页列表查询首页名称信息", httpMethod = "GET")
@ApiImplicitParams({
@ApiImplicitParam(name = "pageNo", value = "第几页", paramType = "query", required = true, dataType = "Integer"),
@ApiImplicitParam(name = "pageSize", value = "每页显示条数", paramType = "query", required = true, dataType = "Integer"),
@ -75,10 +53,11 @@ public class ProjectHomeNameController {
/**
* 列表查询
*
* @return
*/
@OperLog(operModul = "首页名称管理", operType = "列表查询", operDesc = "列表查询首页名称信息")
@ApiOperation(value = "列表查询首页名称信息", notes = "列表查询首页名称信息", httpMethod="GET")
@ApiOperation(value = "列表查询首页名称信息", notes = "列表查询首页名称信息", httpMethod = "GET")
@GetMapping(value = "/list")
public Result<List<ProjectHomeName>> queryList(@ApiIgnore @RequestParam HashMap<String, Object> param) {
return Result.success(projectHomeNameService.queryList(param));
@ -86,53 +65,65 @@ public class ProjectHomeNameController {
/**
* 添加
*
* @param projectHomeName
* @return
*/
@OperLog(operModul = "首页名称管理", operType = "添加", operDesc = "添加首页名称信息")
@ApiOperation(value = "添加首页名称信息", notes = "添加首页名称信息" , httpMethod="POST")
@ApiOperation(value = "添加首页名称信息", notes = "添加首页名称信息", httpMethod = "POST")
@PostMapping(value = "/add")
public Result<ProjectHomeName> add(@RequestBody @Validate ProjectHomeName projectHomeName) {
public Result add(@RequestBody @Validate ProjectHomeName projectHomeName) {
projectHomeNameService.add(projectHomeName);
return Result.ok();
}
@OperLog(operModul = "首页名称管理", operType = "", operDesc = "保存首页名称信息")
@ApiOperation(value = "保存首页名称信息", notes = "保存首页名称信息", httpMethod = "POST")
@PostMapping(value = "/save")
public Result saveName(@RequestBody @Validate ProjectHomeName projectHomeName) {
projectHomeNameService.saveName(projectHomeName);
return Result.ok();
}
/**
* 编辑
*
* @param projectHomeName
* @return
*/
@OperLog(operModul = "首页名称管理", operType = "编辑", operDesc = "编辑首页名称信息")
@ApiOperation(value = "编辑首页名称信息", notes = "编辑首页名称信息" , httpMethod="POST")
@ApiOperation(value = "编辑首页名称信息", notes = "编辑首页名称信息", httpMethod = "POST")
@PostMapping(value = "/edit")
public Result<ProjectHomeName> edit(@RequestBody ProjectHomeName projectHomeName) {
public Result edit(@RequestBody ProjectHomeName projectHomeName) {
projectHomeNameService.edit(projectHomeName);
return Result.ok();
}
/**
* 通过id删除
*
* @return
*/
@OperLog(operModul = "首页名称管理", operType = "删除", operDesc = "删除首页名称信息")
@ApiOperation(value = "删除首页名称信息", notes = "删除首页名称信息" , httpMethod="POST")
@ApiOperation(value = "删除首页名称信息", notes = "删除首页名称信息", httpMethod = "POST")
@ApiImplicitParam(name = "id", value = "首页名称ID", paramType = "body", required = true, dataType = "String", example = "{\"id\":\"1\"}")
@PostMapping(value = "/delete")
public Result<ProjectHomeName> delete(@ApiIgnore @RequestBody HashMap<String ,Object> map) {
public Result delete(@ApiIgnore @RequestBody HashMap<String, Object> map) {
projectHomeNameService.delete(MapUtils.getString(map, "id"));
return Result.ok();
}
/**
* 通过id查询
*
* @param id
* @return
*/
@OperLog(operModul = "首页名称管理", operType = "通过id查询", operDesc = "通过id查询首页名称信息")
@ApiOperation(value = "通过id查询首页名称信息", notes = "通过id查询首页名称信息" , httpMethod="GET")
@ApiOperation(value = "通过id查询首页名称信息", notes = "通过id查询首页名称信息", httpMethod = "GET")
@ApiImplicitParam(name = "id", value = "首页名称ID", paramType = "query", required = true, dataType = "Integer")
@GetMapping(value = "/queryById")
public Result<ProjectHomeName> queryById(@RequestParam(name="id",required=true) String id) {
public Result<ProjectHomeName> queryById(@RequestParam(name = "id", required = true) String id) {
return Result.success(projectHomeNameService.queryById(id));
}

View File

@ -3,6 +3,7 @@ package com.zhgd.xmgl.modules.baotou.entity;
import java.io.Serializable;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
@ -50,6 +51,7 @@ public class ContractorMonthlyQuantity implements Serializable {
/**更新时间*/
@ApiModelProperty(value="更新时间")
private java.util.Date updateTime ;
/**1承包商2项目组**/
@ApiModelProperty(value="1承包商2项目组")
private java.lang.Integer type ;
/**1工程量2计划工程量*/

View File

@ -2,7 +2,10 @@ package com.zhgd.xmgl.modules.baotou.entity;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
@ -54,4 +57,8 @@ public class ProjectHomeWork implements Serializable {
/**更新时间*/
@ApiModelProperty(value="更新时间")
private java.util.Date updateTime ;
@TableField(exist = false)
@ApiModelProperty(value="操作内容")
private List<ProjectHomeWork> opList;
}

View File

@ -6,6 +6,10 @@
select * from (
select t.*
from project_home_work t
where 1=1
<if test="param.projectHomeWorkId == null or param.projectHomeWorkId == ''">
and t.project_home_work_id is null
</if>
)t
${ew.customSqlSegment}
</select>

View File

@ -50,4 +50,6 @@ public interface IProjectHomeCarouselService extends IService<ProjectHomeCarouse
*/
ProjectHomeCarousel queryById(String id);
void saveAll(HashMap<String ,Object> param);
}

View File

@ -50,4 +50,5 @@ public interface IProjectHomeNameService extends IService<ProjectHomeName> {
*/
ProjectHomeName queryById(String id);
void saveName(ProjectHomeName projectHomeName);
}

View File

@ -1,5 +1,4 @@
package com.zhgd.xmgl.modules.baotou.service.impl;
import java.util.Date;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
@ -16,6 +15,7 @@ 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.*;
@ -27,11 +27,11 @@ import com.zhgd.xmgl.modules.worker.service.impl.EnterpriseInfoServiceImpl;
import com.zhgd.xmgl.security.util.SecurityUtils;
import com.zhgd.xmgl.util.*;
import org.apache.commons.collections.MapUtils;
import org.jetbrains.annotations.NotNull;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.util.*;
@ -45,6 +45,7 @@ import java.util.stream.Collectors;
* @version V1.0
*/
@Service
@Transactional(rollbackFor = Exception.class)
public class ContractorMonthlyDetailServiceImpl extends ServiceImpl<ContractorMonthlyDetailMapper, ContractorMonthlyDetail> implements IContractorMonthlyDetailService {
@Autowired
private IContractorMonthlyDetailService contractorMonthlyDetailService;
@ -139,14 +140,95 @@ public class ContractorMonthlyDetailServiceImpl extends ServiceImpl<ContractorMo
@Override
public void saveInfo(ContractorMonthlyDetail detail) {
Integer contentType = detail.getContentType();
int designType = contentType == 5 ? 1 : 2;
List<ContractorMonthlyDetail> details = contractorMonthlyDetailMapper.selectList(new LambdaQueryWrapper<ContractorMonthlyDetail>()
.eq(ContractorMonthlyDetail::getContentType, detail.getContentType())
.eq(ContractorMonthlyDetail::getContentType, contentType)
.eq(ContractorMonthlyDetail::getPeriodId, detail.getPeriodId())
);
ContractorMonthlyPeriod p = contractorMonthlyPeriodService.getById(detail.getPeriodId());
if (p == null) {
throw new OpenAlertException("计划不存在");
}
this.removeMonthWordEdit(detail, p);
if (CollUtil.isEmpty(details)) {
this.add(detail);
} else {
detail.setId(details.get(0).getId());
this.edit(detail);
}
if (Objects.equals(contentType, 1) || Objects.equals(contentType, 2)) {
this.saveRelationPeriod(detail, p);
} else if (Objects.equals(contentType, 5) || Objects.equals(contentType, 6)) {
JSONObject rootJo = JSON.parseObject(detail.getContent());
int length = SheetUtils.getColDataLength(this.getCellData(rootJo), 3, "B");
ContractorMonthlyQuantity quantity = contractorMonthlyQuantityService.getOne(new LambdaQueryWrapper<ContractorMonthlyQuantity>()
.eq(ContractorMonthlyQuantity::getPeriodId, p.getId())
.eq(ContractorMonthlyQuantity::getType, p.getType())
.eq(ContractorMonthlyQuantity::getDesignType, designType)
);
ContractorMonthlyDesign design = contractorMonthlyDesignService.getOne(new LambdaQueryWrapper<ContractorMonthlyDesign>()
.eq(ContractorMonthlyDesign::getDeviceId, p.getDeviceId())
.eq(ContractorMonthlyDesign::getDesignType, designType)
.eq(ContractorMonthlyDesign::getType, p.getType())
);
JSONObject cellData = SheetUtils.getCellData(rootJo);
List<String> designList = SheetUtils.getColDataList(cellData, 3, "C", length);
if (design == null) {
design = new ContractorMonthlyDesign();
design.setProjectSn(detail.getProjectSn());
design.setDeviceId(p.getDeviceId());
design.setDesignType(designType);
design.setQuantity(JSON.toJSONString(designList));
design.setType(p.getType());
contractorMonthlyDesignService.save(design);
} else {
design.setQuantity(JSON.toJSONString(designList));
design.setType(p.getType());
contractorMonthlyDesignService.updateById(design);
}
List<String> mwList = SheetUtils.getColDataList(cellData, 3, "D", length);
List<String> arriveList;
List<String> remarkList;
if (p.getLevelType() == 1) {
arriveList = SheetUtils.getColDataList(cellData, 3, "G", length);
remarkList = SheetUtils.getColDataList(cellData, 3, "I", length);
} else {
arriveList = SheetUtils.getColDataList(cellData, 3, "H", length);
remarkList = SheetUtils.getColDataList(cellData, 3, "J", length);
}
if (quantity == null) {
quantity = new ContractorMonthlyQuantity();
quantity.setProjectSn(detail.getProjectSn());
quantity.setPeriodId(p.getId());
if (p.getLevelType() == 2) {
quantity.setWeekQuantity(JSON.toJSONString(mwList));
}
if (p.getLevelType() == 1) {
quantity.setMonthQuantity(JSON.toJSONString(mwList));
}
quantity.setArriveGoods(JSON.toJSONString(arriveList));
quantity.setRemarks(JSON.toJSONString(remarkList));
quantity.setType(p.getType());
quantity.setDesignType(designType);
contractorMonthlyQuantityService.save(quantity);
} else {
if (p.getLevelType() == 2) {
quantity.setWeekQuantity(JSON.toJSONString(mwList));
}
if (p.getLevelType() == 1) {
quantity.setMonthQuantity(JSON.toJSONString(mwList));
}
quantity.setArriveGoods(JSON.toJSONString(arriveList));
quantity.setRemarks(JSON.toJSONString(remarkList));
quantity.setType(p.getType());
quantity.setDesignType(designType);
contractorMonthlyQuantityService.updateById(quantity);
}
}
}
private void removeMonthWordEdit(ContractorMonthlyDetail detail, ContractorMonthlyPeriod p) {
if (detail.getContentType() == 7 && p.getType() == 2) {
//去掉添加的编辑
String content = detail.getContent();
@ -166,69 +248,6 @@ public class ContractorMonthlyDetailServiceImpl extends ServiceImpl<ContractorMo
}
}
}
if (CollUtil.isEmpty(details)) {
this.add(detail);
} else {
detail.setId(details.get(0).getId());
this.edit(detail);
}
if (Objects.equals(detail.getContentType(), 1) || Objects.equals(detail.getContentType(), 2)) {
this.saveRelationPeriod(detail, p);
} else if (Objects.equals(detail.getContentType(), 5) || Objects.equals(detail.getContentType(), 6)) {
JSONObject rootJo = JSON.parseObject(detail.getContent());
int length = SheetUtils.getColDataLength(rootJo, 3, "B");
ContractorMonthlyQuantity quantity = contractorMonthlyQuantityService.getOne(new LambdaQueryWrapper<ContractorMonthlyQuantity>()
.eq(ContractorMonthlyQuantity::getPeriodId, p.getId()));
ContractorMonthlyDesign design = contractorMonthlyDesignService.getOne(new LambdaQueryWrapper<ContractorMonthlyDesign>()
.eq(ContractorMonthlyDesign::getDeviceId, p.getDeviceId()));
JSONObject cellData = SheetUtils.getCellData(rootJo);
List<String> designList = SheetUtils.getColDataList(cellData, 3, "C", length);
if (design == null) {
design = new ContractorMonthlyDesign();
design.setProjectSn(detail.getProjectSn());
design.setDeviceId(p.getDeviceId());
design.setDesignType(detail.getContentType() == 5 ? 1 : 2);
design.setQuantity(JSON.toJSONString(designList));
contractorMonthlyDesignService.save(design);
} else {
design.setQuantity(JSON.toJSONString(designList));
contractorMonthlyDesignService.updateById(design);
}
List<String> mwList = SheetUtils.getColDataList(cellData, 3, "D", length);
List<String> arriveList;
List<String> remarkList;
if (p.getLevelType() == 1) {
arriveList = SheetUtils.getColDataList(cellData, 3, "G", length);
remarkList = SheetUtils.getColDataList(cellData, 3, "J", length);
} else {
arriveList = SheetUtils.getColDataList(cellData, 3, "H", length);
remarkList = SheetUtils.getColDataList(cellData, 3, "I", length);
}
if (quantity == null) {
quantity = new ContractorMonthlyQuantity();
quantity.setProjectSn(detail.getProjectSn());
quantity.setPeriodId(p.getId());
if (p.getLevelType() == 2) {
quantity.setWeekQuantity(JSON.toJSONString(mwList));
}
if (p.getLevelType() == 1) {
quantity.setMonthQuantity(JSON.toJSONString(mwList));
}
quantity.setArriveGoods(JSON.toJSONString(arriveList));
quantity.setRemarks(JSON.toJSONString(remarkList));
contractorMonthlyQuantityService.save(quantity);
} else {
if (p.getLevelType() == 2) {
quantity.setWeekQuantity(JSON.toJSONString(mwList));
}
if (p.getLevelType() == 1) {
quantity.setMonthQuantity(JSON.toJSONString(mwList));
}
quantity.setArriveGoods(JSON.toJSONString(arriveList));
quantity.setRemarks(JSON.toJSONString(remarkList));
contractorMonthlyQuantityService.updateById(quantity);
}
}
}
private void saveRelationPeriod(ContractorMonthlyDetail detail, ContractorMonthlyPeriod p) {
@ -277,6 +296,7 @@ public class ContractorMonthlyDetailServiceImpl extends ServiceImpl<ContractorMo
ContractorMonthlyPeriod p1 = contractorMonthlyPeriodService.getById(periodId);
p1.setStatus(3);
contractorMonthlyPeriodService.updateById(p1);
ProjectGroup group = projectGroupService.getById(p1.getGroupId());
//这个供应商的detail
List<ContractorMonthlyDetail> details1 = contractorMonthlyDetailMapper.selectList(new LambdaQueryWrapper<ContractorMonthlyDetail>()
.eq(ContractorMonthlyDetail::getPeriodId, periodId));
@ -318,12 +338,39 @@ public class ContractorMonthlyDetailServiceImpl extends ServiceImpl<ContractorMo
.eq(ContractorMonthlyDetail::getContentType, contentType)
.eq(ContractorMonthlyDetail::getPeriodId, period.getId())
);
String content = detail.getContent();
//承包商换成项目组名称
if (contentType == 1 || contentType == 2 || contentType == 3 || contentType == 4) {
JSONObject rootJo = JSON.parseObject(content);
JSONObject cellDataJo = this.getCellData(rootJo);
JSONObject jo = cellDataJo.getJSONObject("0").getJSONObject("0");
String v = jo.getString("v");
List<String> split = StrUtil.split(v, "承包商");
if (CollUtil.isNotEmpty(split)) {
jo.put("v", group.getProjectGroupName() + "项目组" + split.get(split.size() - 1));
}
JSONObject jo1 = cellDataJo.getJSONObject("2").getJSONObject("0");
jo1.put("v", "编制单位:" + group.getProjectGroupName());
content = JSON.toJSONString(rootJo);
}
//工程量的单位名称变成xxx
if (contentType == 5 || contentType == 6) {
JSONObject rootJo = JSON.parseObject(content);
JSONObject cellDataJo = this.getCellData(rootJo);
JSONObject jo = cellDataJo.getJSONObject("1").getJSONObject("0");
String v = jo.getString("v");
List<String> split = StrUtil.split(v, "填报单位:");
if (CollUtil.isNotEmpty(split)) {
jo.put("v", split.get(0) + "填报单位xxx单位");
}
content = JSON.toJSONString(rootJo);
}
if (CollUtil.isEmpty(details)) {
//新增详情
ContractorMonthlyDetail d1 = new ContractorMonthlyDetail();
d1.setPeriodId(period.getId());
d1.setContentType(contentType);
d1.setContent(detail.getContent());
d1.setContent(content);
d1.setType(2);
d1.setProjectSn(detail.getProjectSn());
baseMapper.insert(d1);
@ -333,23 +380,24 @@ public class ContractorMonthlyDetailServiceImpl extends ServiceImpl<ContractorMo
JSONObject rootJo = JSON.parseObject(d2.getContent());
if (Objects.equals(contentType, 1) || Objects.equals(contentType, 2)) {
JSONObject toCellDataJo = this.getCellData(rootJo);
JSONObject fromCellDataJo = this.getCellData(JSON.parseObject(detail.getContent()));
JSONObject fromCellDataJo = this.getCellData(JSON.parseObject(content));
buildToCellDataForOne(toCellDataJo, fromCellDataJo);
} else if (Objects.equals(contentType, 3) || Objects.equals(contentType, 4)) {
JSONObject toCellDataJo = this.getCellData(rootJo);
JSONObject fromCellDataJo = this.getCellData(JSON.parseObject(detail.getContent()));
JSONObject fromCellDataJo = this.getCellData(JSON.parseObject(content));
buildToCellDataForThree(toCellDataJo, fromCellDataJo);
}
d2.setContent(JSON.toJSONString(rootJo));
baseMapper.updateById(d2);
}
//工程量
if (contentType == 5 || contentType == 6) {
//保存工程量
int designType = contentType == 5 ? 1 : 2;
List<ContractorMonthlyDesign> designs = contractorMonthlyDesignService.list(new LambdaQueryWrapper<ContractorMonthlyDesign>()
.eq(ContractorMonthlyDesign::getDeviceId, p1.getDeviceId())
.eq(ContractorMonthlyDesign::getType, 1)
.eq(ContractorMonthlyDesign::getDesignType, contentType == 5 ? 1 : 2)
.eq(ContractorMonthlyDesign::getDesignType, designType)
);
if (CollUtil.isNotEmpty(designs)) {
Optional<ContractorMonthlyDesign> op = designs.stream().filter(o -> o.getType() == 1).findFirst();
@ -359,6 +407,7 @@ public class ContractorMonthlyDetailServiceImpl extends ServiceImpl<ContractorMo
if (op1.isPresent()) {
ContractorMonthlyDesign d = op1.get();
d.setQuantity(cd.getQuantity());
d.setType(2);
contractorMonthlyDesignService.updateById(d);
} else {
ContractorMonthlyDesign d = BeanUtil.toBean(cd, ContractorMonthlyDesign.class);
@ -371,32 +420,76 @@ public class ContractorMonthlyDetailServiceImpl extends ServiceImpl<ContractorMo
List<ContractorMonthlyQuantity> quantityList = contractorMonthlyQuantityService.list(new LambdaQueryWrapper<ContractorMonthlyQuantity>()
.eq(ContractorMonthlyQuantity::getPeriodId, p1.getId())
.eq(ContractorMonthlyQuantity::getType, 1)
.eq(ContractorMonthlyQuantity::getDesignType, contentType == 5 ? 1 : 2)
.eq(ContractorMonthlyQuantity::getDesignType, designType)
);
// if (CollUtil.isNotEmpty(quantityList)) {
// Optional<ContractorMonthlyQuantity> op = quantityList.stream().filter(o -> o.getType() == 1).findFirst();
// if (op.isPresent()) {
// Optional<ContractorMonthlyQuantity> op1 = quantityList.stream().filter(o -> o.getType() == 2).findFirst();
// ContractorMonthlyQuantity cd = op.get();
// if (op1.isPresent()) {
// ContractorMonthlyQuantity d = op1.get();
// d.setQuantity(cd.getQuantity());
// contractorMonthlyDesignService.updateById(d);
// } else {
// ContractorMonthlyQuantity d = BeanUtil.toBean(cd, ContractorMonthlyQuantity.class);
// d.setId(null);
// d.setType(2);
// contractorMonthlyDesignService.save(d);
// }
// }
// }
if (CollUtil.isNotEmpty(quantityList)) {
Optional<ContractorMonthlyQuantity> op = quantityList.stream().filter(o -> o.getType() == 1).findFirst();
if (op.isPresent()) {
ContractorMonthlyQuantity cd = this.getGroupQuantity(p1, designType);
Optional<ContractorMonthlyQuantity> op1 = quantityList.stream().filter(o -> o.getType() == 2).findFirst();
if (op1.isPresent()) {
cd.setId(op1.get().getId());
cd.setType(2);
contractorMonthlyQuantityService.updateById(cd);
} else {
cd.setId(null);
cd.setType(2);
contractorMonthlyQuantityService.save(cd);
}
}
}
}
}
}
private ContractorMonthlyQuantity getGroupQuantity(ContractorMonthlyPeriod period, int designType) {
Long deviceId = period.getDeviceId();
Long groupId = period.getGroupId();
Long periodId = period.getId();
Integer levelType = period.getLevelType();
ContractorMonthlyQuantity monthlyQuantity = new ContractorMonthlyQuantity();
monthlyQuantity.setProjectSn(period.getProjectSn());
monthlyQuantity.setPeriodId(periodId);
Integer type = period.getType();
monthlyQuantity.setType(type);
monthlyQuantity.setDesignType(designType);
//查询所有的period
List<ContractorMonthlyPeriod> periodList = contractorMonthlyPeriodService.list(new LambdaQueryWrapper<ContractorMonthlyPeriod>()
.eq(ContractorMonthlyPeriod::getDeviceId, deviceId)
.eq(ContractorMonthlyPeriod::getGroupId, groupId)
);
if (CollUtil.isNotEmpty(periodList)) {
List<ContractorMonthlyQuantity> quantityList = contractorMonthlyQuantityService.list(new LambdaQueryWrapper<ContractorMonthlyQuantity>()
.eq(ContractorMonthlyQuantity::getDesignType, designType)
.eq(ContractorMonthlyQuantity::getType, type)
.in(ContractorMonthlyQuantity::getPeriodId, periodList.stream().map(ContractorMonthlyPeriod::getId).collect(Collectors.toList())));
int month = DateUtil.month(new Date());
int year = DateUtil.year(new Date());
List<ContractorMonthlyQuantity> quantityList1 = quantityList.stream().filter(o -> Objects.equals(o.getPeriodId(), periodId)).collect(Collectors.toList());
if (CollUtil.isNotEmpty(quantityList1)) {
if (levelType == 2) {
//
List<String> wmQuantitys = quantityList1.stream().map(ContractorMonthlyQuantity::getWeekQuantity).collect(Collectors.toList());
monthlyQuantity.setWeekQuantity(JSON.toJSONString(this.sumListJson(wmQuantitys)));
} else {
//
//本月完成量
List<String> wmQuantitys = quantityList1.stream().map(ContractorMonthlyQuantity::getMonthQuantity).collect(Collectors.toList());
monthlyQuantity.setMonthQuantity(JSON.toJSONString(this.sumListJson(wmQuantitys)));
}
//本期到货
List<String> arriveGoods = quantityList1.stream().map(ContractorMonthlyQuantity::getArriveGoods).collect(Collectors.toList());
monthlyQuantity.setArriveGoods(JSON.toJSONString(this.sumListJson(arriveGoods)));
//备注
List<String> remarks = quantityList1.stream().map(ContractorMonthlyQuantity::getRemarks).collect(Collectors.toList());
monthlyQuantity.setRemarks(JSON.toJSONString(this.splitListJson(remarks)));
}
}
return monthlyQuantity;
}
private void buildToCellDataForThree(JSONObject toCellDataJo, JSONObject fromCellDataJo) {
//插入一列columnCount+1mergeData[].endColumn+1cellData挪动columnData哪行多宽
String addEnterprise = fromCellDataJo.getJSONObject("4").getJSONObject("3").getString("v");
@ -488,18 +581,16 @@ public class ContractorMonthlyDetailServiceImpl extends ServiceImpl<ContractorMo
ContractorMonthlyPeriod period = contractorMonthlyPeriodService.queryById(String.valueOf(periodId));
Integer levelType = MapUtils.getInteger(param, "levelType");
Integer type = MapUtils.getInteger(param, "type");
Long groupId = MapUtils.getLong(param, "groupId");
Long deviceId = MapUtils.getLong(param, "deviceId");
Long groupId = period.getGroupId();
Long deviceId = period.getDeviceId();
Long enterpriseId = MapUtils.getLong(param, "enterpriseId");
DeviceUnit unit = deviceUnitService.getById(deviceId);
ProjectGroup group = projectGroupService.getById(groupId);
EnterpriseInfo info = enterpriseInfoService.getById(enterpriseId);
if (Objects.equals(hasDefault, 1) && StrUtil.isBlank(content)) {
//contentType 1:三月人力滚动计划;2:三月机械滚动计划;3:人力汇总表;4:机械汇总表;5:工程量报表;6:计划工程量报表;7:月报;
if (Objects.equals(contentType, 5) || Objects.equals(contentType, 6)) {
content = getFiveContent(contentType, periodId, levelType, type, groupId, deviceId, enterpriseId);
} else if (Objects.equals(contentType, 7)) {
Integer tempType;
if (Objects.equals(contentType, 7)) {
if (Objects.equals(levelType, 1) && Objects.equals(type, 1)) {
tempType = 10;
} else if (Objects.equals(levelType, 1) && Objects.equals(type, 2)) {
@ -512,9 +603,15 @@ public class ContractorMonthlyDetailServiceImpl extends ServiceImpl<ContractorMo
ContractorMonthlyTemplate template = contractorMonthlyTemplateService.getById(tempType);
content = template.getContent();
} else {
ContractorMonthlyTemplate template = contractorMonthlyTemplateService.getById(contentType);
tempType = contentType;
if (contentType == 5 && levelType == 2) {
tempType = 7;
} else if (contentType == 6 && levelType == 2) {
tempType = 8;
}
ContractorMonthlyTemplate template = contractorMonthlyTemplateService.getById(tempType);
content = template.getContent();
if (Objects.equals(levelType, 2)) {
if (Objects.equals(levelType, 2) && contentType <= 4) {
content = content.replace("", "");
}
String groupName = "";
@ -522,7 +619,11 @@ public class ContractorMonthlyDetailServiceImpl extends ServiceImpl<ContractorMo
if (Objects.equals(type, 1)) {
content = content.replace("项目组", "承包商");
groupName = en;
} else {
groupName = group != null ? group.getProjectGroupName() : "xxx";
}
String unitName = unit != null ? unit.getDeviceUnitName() : "xxx";
content = content.replace("{{unitName}}", unitName);
content = content.replace("{{groupName}}", groupName);
Date date = new Date();
DateTime s1 = DateUtil.offsetDay(date, -7);
@ -533,7 +634,6 @@ public class ContractorMonthlyDetailServiceImpl extends ServiceImpl<ContractorMo
content = content.replace("{{enterpriseName}}", en);
//取上周的
if (period != null) {
ContractorMonthlyPeriod p1 = contractorMonthlyPeriodService.getBeforePeriod(period);
ContractorMonthlyPeriod beforeP = contractorMonthlyPeriodService.queryByEntity(p1);
if (beforeP != null) {
@ -552,9 +652,13 @@ public class ContractorMonthlyDetailServiceImpl extends ServiceImpl<ContractorMo
}
}
}
//设置工程量的本周月等的量
if (Objects.equals(contentType, 5) || Objects.equals(contentType, 6)) {
content = this.getFiveContent(contentType, periodId, levelType, type, groupId, deviceId, enterpriseId, content);
}
if (contentType == 7) {
if (contentType == 7 && type == 2) {
//设置月报编辑权限增加编辑链接
List<Long> titleIds = contractorMonthlyConfigService.list(new LambdaQueryWrapper<ContractorMonthlyConfig>()
.eq(ContractorMonthlyConfig::getUserId, SecurityUtils.getUser().getUserId())).stream().map(ContractorMonthlyConfig::getTitleId).collect(Collectors.toList());
@ -603,33 +707,35 @@ public class ContractorMonthlyDetailServiceImpl extends ServiceImpl<ContractorMo
return content;
}
private String getFiveContent(Integer contentType, Long periodId, Integer levelType, Integer type, Long groupId, Long deviceId, Long enterpriseId) {
String content;
private String getFiveContent(Integer contentType, Long periodId, Integer levelType, Integer type, Long groupId, Long deviceId, Long enterpriseId, String content) {
Integer tempType;
int designType;
if (Objects.equals(contentType, 5)) {
if (Objects.equals(levelType, 1)) {
tempType = 5;
} else {
tempType = 7;
}
designType = 1;
} else {
if (Objects.equals(levelType, 1)) {
tempType = 6;
} else {
tempType = 8;
}
designType = 2;
}
ContractorMonthlyTemplate template = contractorMonthlyTemplateService.getById(tempType);
content = template.getContent();
JSONObject toJo = JSON.parseObject(content);
JSONObject toCellDataJo = getCellData(toJo);
//设计总量
ContractorMonthlyDesign design = contractorMonthlyDesignService.getOne(new LambdaQueryWrapper<ContractorMonthlyDesign>()
.eq(ContractorMonthlyDesign::getDeviceId, deviceId)
.eq(ContractorMonthlyDesign::getDesignType, designType)
.eq(ContractorMonthlyDesign::getType, contentType == 5 ? 1 : 2)
);
if (design != null) {
List<String> list = BeanUtil.copyToList(JSON.parseArray(design.getQuantity()), String.class);
List<String> list = JSON.parseObject(design.getQuantity(), new TypeReference<List<String>>() {
});
SheetUtils.setColDataList(toCellDataJo, 3, "C", list);
}
//查询所有的period
@ -640,22 +746,26 @@ public class ContractorMonthlyDetailServiceImpl extends ServiceImpl<ContractorMo
);
if (CollUtil.isNotEmpty(periodList)) {
List<ContractorMonthlyQuantity> quantityList = contractorMonthlyQuantityService.list(new LambdaQueryWrapper<ContractorMonthlyQuantity>()
.eq(ContractorMonthlyQuantity::getType, type)
.eq(ContractorMonthlyQuantity::getDesignType, designType)
.in(ContractorMonthlyQuantity::getPeriodId, periodList.stream().map(ContractorMonthlyPeriod::getId).collect(Collectors.toList())));
int month = DateUtil.month(new Date());
int year = DateUtil.year(new Date());
Optional<ContractorMonthlyQuantity> op = quantityList.stream().filter(o -> Objects.equals(o.getPeriodId(), periodId)).collect(Collectors.toList()).stream().findAny();
if (op.isPresent()) {
ContractorMonthlyPeriod thisP = periodList.stream().filter(o -> Objects.equals(o.getId(), periodId)).findFirst().get();
int month = thisP.getMonth();
int year = thisP.getYear();
int whichWeek = thisP.getWhichWeek();
ContractorMonthlyQuantity quantity = op.get();
if (levelType == 2) {
//
String wmQuantity = quantity.getWeekQuantity();
SheetUtils.setColDataList(toCellDataJo, 3, "D", wmQuantity);
//本月完成量
List<Long> pids1 = periodList.stream().filter(o -> isLessOrEqual(o, year, month, null)).map(ContractorMonthlyPeriod::getId).collect(Collectors.toList());
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());
SheetUtils.setColDataList(toCellDataJo, 3, "E", this.sumListJson(months));
//本年累计完成量
List<Long> pids2 = periodList.stream().filter(o -> isLessOrEqual(o, year, null, null)).map(ContractorMonthlyPeriod::getId).collect(Collectors.toList());
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::getWeekQuantity).collect(Collectors.toList());
SheetUtils.setColDataList(toCellDataJo, 3, "F", this.sumListJson(years));
//开累完成量
@ -675,7 +785,7 @@ public class ContractorMonthlyDetailServiceImpl extends ServiceImpl<ContractorMo
//本月完成量
SheetUtils.setColDataList(toCellDataJo, 3, "D", quantity.getMonthQuantity());
//本年累计完成量
List<Long> pids2 = periodList.stream().filter(o -> isLessOrEqual(o, year, null, null)).map(ContractorMonthlyPeriod::getId).collect(Collectors.toList());
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());
SheetUtils.setColDataList(toCellDataJo, 3, "E", this.sumListJson(years));
//开累完成量
@ -705,7 +815,6 @@ public class ContractorMonthlyDetailServiceImpl extends ServiceImpl<ContractorMo
}
@NotNull
private List<String> sumListJson(List<String> months) {
List<BigDecimal> monthList = new ArrayList<>();
for (String s : months) {
@ -722,6 +831,25 @@ public class ContractorMonthlyDetailServiceImpl extends ServiceImpl<ContractorMo
return list;
}
private List<String> splitListJson(List<String> ss) {
List<String> rs = new ArrayList<>();
for (String s : ss) {
JSONArray array = JSON.parseArray(s);
for (int i = 0; i < array.size(); i++) {
if (rs.size() < i + 1) {
rs.add("");
}
String d = array.getString(i);
String s1 = rs.get(i);
if (StrUtil.isNotBlank(s1) && StrUtil.isNotBlank(d)) {
s1 += ",";
}
rs.add(i, s1 + d);
}
}
return rs;
}
@Override
public void saveAllInfo(HashMap<String, Object> param) {
for (Map.Entry<String, Object> entry : param.entrySet()) {

View File

@ -8,12 +8,15 @@ 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.ContractorMonthlyPeriod;
import com.zhgd.xmgl.modules.baotou.entity.ContractorMonthlyQuantity;
import com.zhgd.xmgl.modules.baotou.mapper.ContractorMonthlyPeriodMapper;
import com.zhgd.xmgl.modules.baotou.service.IContractorMonthlyDesignService;
import com.zhgd.xmgl.modules.baotou.service.IContractorMonthlyDetailService;
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.springframework.beans.factory.annotation.Autowired;
@ -35,6 +38,10 @@ public class ContractorMonthlyPeriodServiceImpl extends ServiceImpl<ContractorMo
private ContractorMonthlyPeriodMapper contractorMonthlyPeriodMapper;
@Autowired
private IContractorMonthlyDetailService contractorMonthlyDetailService;
@Autowired
private IContractorMonthlyQuantityService contractorMonthlyQuantityService;
@Autowired
private IContractorMonthlyDesignService contractorMonthlyDesignService;
@Override
public IPage<ContractorMonthlyPeriod> queryPageList(HashMap<String, Object> param) {
@ -100,7 +107,9 @@ public class ContractorMonthlyPeriodServiceImpl extends ServiceImpl<ContractorMo
baseMapper.deleteById(id);
contractorMonthlyDetailService.remove(new LambdaQueryWrapper<ContractorMonthlyDetail>()
.eq(ContractorMonthlyDetail::getPeriodId, contractorMonthlyPeriod.getId()));
.eq(ContractorMonthlyDetail::getPeriodId, id));
contractorMonthlyQuantityService.remove(new LambdaQueryWrapper<ContractorMonthlyQuantity>()
.eq(ContractorMonthlyQuantity::getPeriodId, id));
}
@Override

View File

@ -1,21 +1,26 @@
package com.zhgd.xmgl.modules.baotou.service.impl;
import com.zhgd.jeecg.common.execption.OpenAlertException;
import com.zhgd.xmgl.modules.baotou.entity.ProjectHomeCarousel;
import com.zhgd.xmgl.modules.baotou.mapper.ProjectHomeCarouselMapper;
import com.zhgd.xmgl.modules.baotou.service.IProjectHomeCarouselService;
import org.springframework.stereotype.Service;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zhgd.jeecg.common.system.query.QueryGenerator;
import com.zhgd.xmgl.util.PageUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gexin.fastjson.JSON;
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.ProjectHomeCarousel;
import com.zhgd.xmgl.modules.baotou.mapper.ProjectHomeCarouselMapper;
import com.zhgd.xmgl.modules.baotou.service.IProjectHomeCarouselService;
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 java.util.HashMap;
import java.util.List;
import com.zhgd.xmgl.util.RefUtil;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.beans.factory.annotation.Autowired;
/**
* @Description: 首页轮播图
@ -27,11 +32,12 @@ import org.springframework.beans.factory.annotation.Autowired;
public class ProjectHomeCarouselServiceImpl extends ServiceImpl<ProjectHomeCarouselMapper, ProjectHomeCarousel> implements IProjectHomeCarouselService {
@Autowired
private ProjectHomeCarouselMapper projectHomeCarouselMapper;
@Override
public IPage<ProjectHomeCarousel> queryPageList(HashMap<String, Object> param) {
QueryWrapper<ProjectHomeCarousel> queryWrapper = this.getQueryWrapper(param);
Page<ProjectHomeCarousel> page = PageUtil.getPage(param);
IPage<ProjectHomeCarousel> pageList = baseMapper.queryList(page, queryWrapper,param);
IPage<ProjectHomeCarousel> pageList = baseMapper.queryList(page, queryWrapper, param);
pageList.setRecords(this.dealList(pageList.getRecords()));
return pageList;
}
@ -39,7 +45,7 @@ public class ProjectHomeCarouselServiceImpl extends ServiceImpl<ProjectHomeCarou
@Override
public List<ProjectHomeCarousel> queryList(HashMap<String, Object> param) {
QueryWrapper<ProjectHomeCarousel> queryWrapper = getQueryWrapper(param);
return dealList(baseMapper.queryList(queryWrapper,param));
return dealList(baseMapper.queryList(queryWrapper, param));
}
private QueryWrapper<ProjectHomeCarousel> getQueryWrapper(HashMap<String, Object> param) {
@ -61,7 +67,7 @@ public class ProjectHomeCarouselServiceImpl extends ServiceImpl<ProjectHomeCarou
@Override
public void edit(ProjectHomeCarousel projectHomeCarousel) {
ProjectHomeCarousel oldProjectHomeCarousel = baseMapper.selectById(projectHomeCarousel.getId());
if(oldProjectHomeCarousel==null) {
if (oldProjectHomeCarousel == null) {
throw new OpenAlertException("未找到对应实体");
}
baseMapper.updateById(projectHomeCarousel);
@ -70,7 +76,7 @@ public class ProjectHomeCarouselServiceImpl extends ServiceImpl<ProjectHomeCarou
@Override
public void delete(String id) {
ProjectHomeCarousel projectHomeCarousel = baseMapper.selectById(id);
if(projectHomeCarousel==null) {
if (projectHomeCarousel == null) {
throw new OpenAlertException("未找到对应实体");
}
baseMapper.deleteById(id);
@ -85,4 +91,19 @@ public class ProjectHomeCarouselServiceImpl extends ServiceImpl<ProjectHomeCarou
return entity;
}
@Override
public void saveAll(HashMap<String, Object> param) {
String projectSn = MapUtils.getString(param, "projectSn");
projectHomeCarouselMapper.delete(new LambdaQueryWrapper<ProjectHomeCarousel>()
.eq(ProjectHomeCarousel::getProjectSn, projectSn));
List<ProjectHomeCarousel> fileUrlList = JSON.parseObject(JSON.toJSONString(param.get("fileUrlList")), new TypeReference<List<ProjectHomeCarousel>>() {
});
if (CollUtil.isNotEmpty(fileUrlList)) {
for (ProjectHomeCarousel carousel : fileUrlList) {
carousel.setProjectSn(projectSn);
projectHomeCarouselMapper.insert(carousel);
}
}
}
}

View File

@ -1,21 +1,22 @@
package com.zhgd.xmgl.modules.baotou.service.impl;
import com.zhgd.jeecg.common.execption.OpenAlertException;
import com.zhgd.xmgl.modules.baotou.entity.ProjectHomeName;
import com.zhgd.xmgl.modules.baotou.mapper.ProjectHomeNameMapper;
import com.zhgd.xmgl.modules.baotou.service.IProjectHomeNameService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zhgd.jeecg.common.system.query.QueryGenerator;
import com.zhgd.xmgl.util.PageUtil;
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.ProjectHomeName;
import com.zhgd.xmgl.modules.baotou.mapper.ProjectHomeNameMapper;
import com.zhgd.xmgl.modules.baotou.service.IProjectHomeNameService;
import com.zhgd.xmgl.util.PageUtil;
import com.zhgd.xmgl.util.RefUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.List;
import com.zhgd.xmgl.util.RefUtil;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.beans.factory.annotation.Autowired;
/**
* @Description: 首页名称
@ -27,11 +28,12 @@ import org.springframework.beans.factory.annotation.Autowired;
public class ProjectHomeNameServiceImpl extends ServiceImpl<ProjectHomeNameMapper, ProjectHomeName> implements IProjectHomeNameService {
@Autowired
private ProjectHomeNameMapper projectHomeNameMapper;
@Override
public IPage<ProjectHomeName> queryPageList(HashMap<String, Object> param) {
QueryWrapper<ProjectHomeName> queryWrapper = this.getQueryWrapper(param);
Page<ProjectHomeName> page = PageUtil.getPage(param);
IPage<ProjectHomeName> pageList = baseMapper.queryList(page, queryWrapper,param);
IPage<ProjectHomeName> pageList = baseMapper.queryList(page, queryWrapper, param);
pageList.setRecords(this.dealList(pageList.getRecords()));
return pageList;
}
@ -39,7 +41,7 @@ public class ProjectHomeNameServiceImpl extends ServiceImpl<ProjectHomeNameMappe
@Override
public List<ProjectHomeName> queryList(HashMap<String, Object> param) {
QueryWrapper<ProjectHomeName> queryWrapper = getQueryWrapper(param);
return dealList(baseMapper.queryList(queryWrapper,param));
return dealList(baseMapper.queryList(queryWrapper, param));
}
private QueryWrapper<ProjectHomeName> getQueryWrapper(HashMap<String, Object> param) {
@ -61,7 +63,7 @@ public class ProjectHomeNameServiceImpl extends ServiceImpl<ProjectHomeNameMappe
@Override
public void edit(ProjectHomeName projectHomeName) {
ProjectHomeName oldProjectHomeName = baseMapper.selectById(projectHomeName.getId());
if(oldProjectHomeName==null) {
if (oldProjectHomeName == null) {
throw new OpenAlertException("未找到对应实体");
}
baseMapper.updateById(projectHomeName);
@ -70,7 +72,7 @@ public class ProjectHomeNameServiceImpl extends ServiceImpl<ProjectHomeNameMappe
@Override
public void delete(String id) {
ProjectHomeName projectHomeName = baseMapper.selectById(id);
if(projectHomeName==null) {
if (projectHomeName == null) {
throw new OpenAlertException("未找到对应实体");
}
baseMapper.deleteById(id);
@ -85,4 +87,18 @@ public class ProjectHomeNameServiceImpl extends ServiceImpl<ProjectHomeNameMappe
return entity;
}
@Override
public void saveName(ProjectHomeName projectHomeName) {
ProjectHomeName name = projectHomeNameMapper.selectOne(new LambdaQueryWrapper<ProjectHomeName>()
.eq(ProjectHomeName::getWhichType, projectHomeName.getWhichType())
.eq(ProjectHomeName::getProjectSn, projectHomeName.getProjectSn())
);
if (name == null) {
baseMapper.insert(projectHomeName);
} else {
projectHomeName.setId(name.getId());
baseMapper.updateById(projectHomeName);
}
}
}

View File

@ -1,21 +1,24 @@
package com.zhgd.xmgl.modules.baotou.service.impl;
import com.zhgd.jeecg.common.execption.OpenAlertException;
import com.zhgd.xmgl.modules.baotou.entity.ProjectHomeWork;
import com.zhgd.xmgl.modules.baotou.mapper.ProjectHomeWorkMapper;
import com.zhgd.xmgl.modules.baotou.service.IProjectHomeWorkService;
import org.springframework.stereotype.Service;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zhgd.jeecg.common.system.query.QueryGenerator;
import com.zhgd.xmgl.util.PageUtil;
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.ProjectHomeWork;
import com.zhgd.xmgl.modules.baotou.mapper.ProjectHomeWorkMapper;
import com.zhgd.xmgl.modules.baotou.service.IProjectHomeWorkService;
import com.zhgd.xmgl.util.PageUtil;
import com.zhgd.xmgl.util.RefUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.HashMap;
import java.util.List;
import com.zhgd.xmgl.util.RefUtil;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.beans.factory.annotation.Autowired;
/**
* @Description: 首页办事指南
@ -24,14 +27,16 @@ import org.springframework.beans.factory.annotation.Autowired;
* @version V1.0
*/
@Service
@Transactional(rollbackFor = Exception.class)
public class ProjectHomeWorkServiceImpl extends ServiceImpl<ProjectHomeWorkMapper, ProjectHomeWork> implements IProjectHomeWorkService {
@Autowired
private ProjectHomeWorkMapper projectHomeWorkMapper;
@Override
public IPage<ProjectHomeWork> queryPageList(HashMap<String, Object> param) {
QueryWrapper<ProjectHomeWork> queryWrapper = this.getQueryWrapper(param);
Page<ProjectHomeWork> page = PageUtil.getPage(param);
IPage<ProjectHomeWork> pageList = baseMapper.queryList(page, queryWrapper,param);
IPage<ProjectHomeWork> pageList = baseMapper.queryList(page, queryWrapper, param);
pageList.setRecords(this.dealList(pageList.getRecords()));
return pageList;
}
@ -39,7 +44,7 @@ public class ProjectHomeWorkServiceImpl extends ServiceImpl<ProjectHomeWorkMappe
@Override
public List<ProjectHomeWork> queryList(HashMap<String, Object> param) {
QueryWrapper<ProjectHomeWork> queryWrapper = getQueryWrapper(param);
return dealList(baseMapper.queryList(queryWrapper,param));
return dealList(baseMapper.queryList(queryWrapper, param));
}
private QueryWrapper<ProjectHomeWork> getQueryWrapper(HashMap<String, Object> param) {
@ -56,24 +61,47 @@ public class ProjectHomeWorkServiceImpl extends ServiceImpl<ProjectHomeWorkMappe
public void add(ProjectHomeWork projectHomeWork) {
projectHomeWork.setId(null);
baseMapper.insert(projectHomeWork);
this.saveOpList(projectHomeWork);
}
private void saveOpList(ProjectHomeWork projectHomeWork) {
Long id = projectHomeWork.getId();
projectHomeWorkMapper.delete(new LambdaQueryWrapper<ProjectHomeWork>()
.eq(ProjectHomeWork::getProjectHomeWorkId, id));
List<ProjectHomeWork> opList = projectHomeWork.getOpList();
if (CollUtil.isNotEmpty(opList)) {
for (ProjectHomeWork homeWork : opList) {
homeWork.setId(null);
homeWork.setProjectHomeWorkId(id);
homeWork.setProjectSn(projectHomeWork.getProjectSn());
homeWork.setWhichModule(projectHomeWork.getWhichModule());
projectHomeWorkMapper.insert(homeWork);
}
}
}
@Override
public void edit(ProjectHomeWork projectHomeWork) {
ProjectHomeWork oldProjectHomeWork = baseMapper.selectById(projectHomeWork.getId());
if(oldProjectHomeWork==null) {
if (oldProjectHomeWork == null) {
throw new OpenAlertException("未找到对应实体");
}
baseMapper.updateById(projectHomeWork);
this.saveOpList(projectHomeWork);
}
@Override
public void delete(String id) {
ProjectHomeWork projectHomeWork = baseMapper.selectById(id);
if(projectHomeWork==null) {
if (projectHomeWork == null) {
throw new OpenAlertException("未找到对应实体");
}
baseMapper.deleteById(id);
projectHomeWorkMapper.delete(new LambdaQueryWrapper<ProjectHomeWork>()
.eq(ProjectHomeWork::getProjectHomeWorkId, id));
}
@Override

View File

@ -138,7 +138,7 @@ public interface WorkerAttendanceMapper extends BaseMapper<WorkerAttendance> {
* @param workerId
* @return
*/
String getWorkerAttendanceMinTime(@Param("workerId") Integer workerId);
String getWorkerAttendanceMinTime(@Param("workerId") String workerId);
/**
* 查询今日最晚通行的时间
@ -146,7 +146,7 @@ public interface WorkerAttendanceMapper extends BaseMapper<WorkerAttendance> {
* @param workerId
* @return
*/
String getWorkerAttendanceMaxTime(@Param("workerId") Integer workerId);
String getWorkerAttendanceMaxTime(@Param("workerId") String workerId);
/**
* 统计某日出勤人数统计

View File

@ -492,8 +492,8 @@ public class WorkerAttendanceServiceImpl extends ServiceImpl<WorkerAttendanceMap
@Override
public Map<String, Object> getPersonAttendanceTime(Map<String, Object> map) {
Map<String, Object> data = new HashMap<>(16);
String enterTime = workerAttendanceMapper.getWorkerAttendanceMinTime(MapUtils.getInteger(map, "workerId"));
String outTime = workerAttendanceMapper.getWorkerAttendanceMaxTime(MapUtils.getInteger(map, "workerId"));
String enterTime = workerAttendanceMapper.getWorkerAttendanceMinTime(MapUtils.getString(map, "workerId"));
String outTime = workerAttendanceMapper.getWorkerAttendanceMaxTime(MapUtils.getString(map, "workerId"));
data.put("enterTime", enterTime);
data.put("outTime", outTime);
return data;

View File

@ -4,6 +4,7 @@ import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.StrUtil;
import com.gexin.fastjson.JSON;
import com.gexin.fastjson.JSONObject;
import com.gexin.fastjson.TypeReference;
import java.util.*;
@ -102,15 +103,15 @@ public class SheetUtils {
/**
* 获取col连续不为空的数量
*
* @param jo
* @param cellDataJo
* @param row
* @param col
* @return
*/
public static int getColDataLength(JSONObject jo, int row, int col) {
public static int getColDataLength(JSONObject cellDataJo, int row, int col) {
int num = 0;
for (int r1 = row; r1 < jo.size(); r1++) {
String v = Optional.ofNullable(jo.getJSONObject(row + "")).map(m -> m.getJSONObject(col + "")).map(m -> m.getString("v")).orElse(null);
for (int r1 = row; r1 < cellDataJo.size(); r1++) {
String v = Optional.ofNullable(cellDataJo.getJSONObject(row + "")).map(m -> m.getJSONObject(col + "")).map(m -> m.getString("v")).orElse(null);
if (StrUtil.isBlank(v)) {
break;
}
@ -119,8 +120,8 @@ public class SheetUtils {
return num;
}
public static int getColDataLength(JSONObject jo, int row, String col) {
return getColDataLength(jo, row, Integer.parseInt(getColNum(col)));
public static int getColDataLength(JSONObject cellDataJo, int row, String col) {
return getColDataLength(cellDataJo, row, Integer.parseInt(getColNum(col)));
}
public static String getColNum(String col) {
@ -166,7 +167,7 @@ public class SheetUtils {
}
public static void setColDataList(JSONObject toCellDataJo, int row, String col, String jsonStr) {
List<String> addList = BeanUtil.copyToList(JSON.parseArray(jsonStr), String.class);
List<String> addList = JSON.parseObject(jsonStr,new TypeReference<List<String>>(){});
setColDataList(toCellDataJo, row, col, addList);
}