424 lines
16 KiB
Plaintext
424 lines
16 KiB
Plaintext
package com.sercurityControl.proteam.service.impl;
|
|
|
|
import cn.afterturn.easypoi.cache.manager.IFileLoader;
|
|
import com.github.pagehelper.PageInfo;
|
|
import com.securityControl.common.core.utils.StringUtils;
|
|
import com.securityControl.common.core.utils.aes.DateTimeHelper;
|
|
import com.securityControl.common.core.utils.aes.ListHelper;
|
|
import com.securityControl.common.core.utils.aes.StringHelper;
|
|
import com.securityControl.common.core.web.domain.AjaxResult;
|
|
import com.securityControl.common.redis.service.RedisService;
|
|
import com.sercurityControl.proteam.domain.*;
|
|
import com.sercurityControl.proteam.domain.vo.PreservationVo;
|
|
import com.sercurityControl.proteam.domain.vo.ReturnCodeEntity;
|
|
import com.sercurityControl.proteam.mapper.ProDataMapper;
|
|
import com.sercurityControl.proteam.mapper.TeamMapper;
|
|
import com.sercurityControl.proteam.service.ProDataService;
|
|
import io.swagger.models.auth.In;
|
|
import io.swagger.v3.oas.annotations.parameters.RequestBody;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import javax.annotation.Resource;
|
|
import java.text.DecimalFormat;
|
|
import java.util.ArrayList;
|
|
import java.util.Arrays;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
|
|
@Service
|
|
@Slf4j
|
|
public class ProDataServiceImpl implements ProDataService {
|
|
@Autowired
|
|
private ProDataMapper mapper;
|
|
@Resource
|
|
private RedisService redisService;
|
|
@Resource
|
|
private HomeDataServiceImpl homeDataService;
|
|
|
|
@Override
|
|
public List<TicketData> getTicketLists(TicketData ticketData) {
|
|
try{
|
|
List<TicketData> list= mapper.getTicketLists(ticketData);
|
|
if(ListHelper.isNotEmpty(list)){
|
|
list.forEach(vo -> {
|
|
WorkInfoVo workInfoVo=homeDataService.getWorkInfo(vo.getId());
|
|
vo.setWorkContent(workInfoVo.getWorkContent());
|
|
});
|
|
}
|
|
return list;
|
|
}catch (Exception e){
|
|
log.error(e.toString(),e);
|
|
}
|
|
return new ArrayList<>();
|
|
}
|
|
|
|
@Override
|
|
public List<ClassData> getClassLists(ClassData classData) {
|
|
try{
|
|
return mapper.getClassLists(classData);
|
|
}catch (Exception e){
|
|
log.error(e.toString(),e);
|
|
}
|
|
return new ArrayList<>();
|
|
}
|
|
|
|
@Override
|
|
public AjaxResult getBasicInfoData(ProData proData) {
|
|
try{
|
|
if (StringUtils.isNotBlank(proData.getBidCode())) {
|
|
String[] arr = proData.getBidCode().split(",");
|
|
List<String> list = Arrays.asList(arr);
|
|
proData.setBidCodeList(list);
|
|
}
|
|
if (StringUtils.isNotBlank(proData.getBuildUnit())) {
|
|
String[] arr = proData.getBuildUnit().split(",");
|
|
List<String> list = Arrays.asList(arr);
|
|
proData.setBuildUnitList(list);
|
|
}
|
|
ProDataNum pro=mapper.getBasicInfoData(proData);
|
|
String allPeopleNum=(String)redisService.get("allPeopleNum");
|
|
if(StringHelper.isNotEmpty(allPeopleNum)){
|
|
pro.setSgNum(allPeopleNum);
|
|
}
|
|
return AjaxResult.success(pro);
|
|
}catch (Exception e){
|
|
log.error(e.toString(),e);
|
|
}
|
|
return AjaxResult.success(new ProDataNum());
|
|
}
|
|
|
|
|
|
@Override
|
|
public List<ProData> getProList(ProData proData) {
|
|
try{
|
|
if (StringUtils.isNotBlank(proData.getBidCode())) {
|
|
String[] arr = proData.getBidCode().split(",");
|
|
List<String> list = Arrays.asList(arr);
|
|
proData.setBidCodeList(list);
|
|
}
|
|
if (StringUtils.isNotBlank(proData.getBuildUnit())) {
|
|
String[] arr = proData.getBuildUnit().split(",");
|
|
List<String> list = Arrays.asList(arr);
|
|
proData.setBuildUnitList(list);
|
|
}
|
|
List<ProData> proList = mapper.getProList(proData);
|
|
//查询工程其他信息
|
|
if(ListHelper.isNotEmpty(proList)){
|
|
proList.forEach(pro->{
|
|
//总监理
|
|
StringBuffer zjlgcs=new StringBuffer();
|
|
//业主
|
|
StringBuffer yzxmjl=new StringBuffer();
|
|
//施工
|
|
StringBuffer sgxmjl=new StringBuffer();
|
|
|
|
StringBuffer jldw=new StringBuffer();
|
|
|
|
StringBuffer sgdw=new StringBuffer();
|
|
|
|
List<JjUser> unitList=mapper.getUnit(pro.getBidCode());
|
|
|
|
//施工单位-->监理单位
|
|
if (ListHelper.isNotEmpty(unitList)) {
|
|
unitList.forEach(unit->{
|
|
if("1".equals(unit.getType())){
|
|
AppendData(jldw,unit.getName(),null);
|
|
}else{
|
|
AppendData(sgdw,unit.getName(),null);
|
|
}
|
|
});
|
|
pro.setSgDw(sgdw.toString());
|
|
pro.setJdDw(jldw.toString());
|
|
}
|
|
//项目经理信息
|
|
List<JjUser> userList=mapper.getUserList(pro.getBidCode());
|
|
if (ListHelper.isNotEmpty(userList)) {
|
|
userList.forEach(user->{
|
|
// 业主项目经理
|
|
if("0400101".equals(user.getJobCode())){
|
|
AppendData(yzxmjl,user.getUserName(),user.getPhone());
|
|
//、项目安全总监
|
|
}else if("0600103".equals(user.getJobCode())){
|
|
AppendData(zjlgcs,user.getUserName(),user.getPhone());
|
|
//、'施工项目经理'
|
|
}else if("0700101".equals(user.getJobCode())){
|
|
AppendData(sgxmjl,user.getUserName(),user.getPhone());
|
|
}
|
|
});
|
|
pro.setZjlgcs(zjlgcs.toString());
|
|
pro.setYzxmjl(yzxmjl.toString());
|
|
pro.setSgxmjl(sgxmjl.toString());
|
|
}
|
|
List<String> numList = mapper.getClassPeople(pro.getBidCode());
|
|
pro.setTzNum(numList.get(0));
|
|
pro.setYzNum(numList.get(1));
|
|
pro.setEjfxNum(numList.get(2));
|
|
pro.setSjfxNum(numList.get(3));
|
|
pro.setFffNum(numList.get(4));
|
|
pro.setWjfxNum(numList.get(5));
|
|
pro.setTeamNum(numList.get(6));
|
|
pro.setWzNum(numList.get(7));
|
|
});
|
|
}
|
|
|
|
return proList;
|
|
}catch (Exception e){
|
|
log.error(e.toString(),e);
|
|
}
|
|
return new ArrayList<ProData>();
|
|
}
|
|
|
|
private void AppendData(StringBuffer buffer,String name,String phone){
|
|
if (StringHelper.isNotEmpty(buffer.toString())){
|
|
buffer.append(";");
|
|
}
|
|
if(StringHelper.isNotEmpty(name)){
|
|
buffer.append(name);
|
|
if(StringHelper.isNotEmpty(phone)){
|
|
buffer.append(":");
|
|
buffer.append(phone);
|
|
}
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 获取工程下拉框
|
|
*
|
|
* @return 集合
|
|
*/
|
|
@Override
|
|
public AjaxResult getProject(ProData entity) {
|
|
return AjaxResult.success(mapper.getProject(entity));
|
|
}
|
|
|
|
@Override
|
|
public AjaxResult getProjectSelect(ProData entity) {
|
|
return AjaxResult.success(mapper.getProjectSelect(entity));
|
|
}
|
|
|
|
/**
|
|
* 查询工作详情
|
|
* @param proData
|
|
* @return
|
|
*/
|
|
@Override
|
|
public ProData getProdDetail(ProData proData) {
|
|
ProData pro=new ProData();
|
|
try{
|
|
List<ProData> list=mapper.getProdDetail(proData);
|
|
if(ListHelper.isNotEmpty(list)){
|
|
pro=list.get(0);
|
|
//总监理
|
|
StringBuffer zjlgcs=new StringBuffer();
|
|
//业主
|
|
StringBuffer yzxmjl=new StringBuffer();
|
|
//施工
|
|
StringBuffer sgxmjl=new StringBuffer();
|
|
|
|
StringBuffer jldw=new StringBuffer();
|
|
|
|
StringBuffer sgdw=new StringBuffer();
|
|
|
|
List<JjUser> unitList=mapper.getUnit(pro.getBidCode());
|
|
|
|
//施工单位-->监理单位
|
|
if (ListHelper.isNotEmpty(unitList)) {
|
|
unitList.forEach(unit->{
|
|
if("1".equals(unit.getType())){
|
|
AppendData(jldw,unit.getName(),null);
|
|
}else{
|
|
AppendData(sgdw,unit.getName(),null);
|
|
}
|
|
});
|
|
pro.setSgDw(sgdw.toString());
|
|
pro.setJdDw(jldw.toString());
|
|
}
|
|
//项目经理信息
|
|
List<JjUser> userList=mapper.getUserList(pro.getBidCode());
|
|
if (ListHelper.isNotEmpty(userList)) {
|
|
userList.forEach(user->{
|
|
// 业主项目经理
|
|
if("0400101".equals(user.getJobCode())){
|
|
AppendData(yzxmjl,user.getUserName(),user.getPhone());
|
|
//、项目安全总监
|
|
}else if("0600103".equals(user.getJobCode())){
|
|
AppendData(zjlgcs,user.getUserName(),user.getPhone());
|
|
//、'施工项目经理'
|
|
}else if("0700101".equals(user.getJobCode())){
|
|
AppendData(sgxmjl,user.getUserName(),user.getPhone());
|
|
}
|
|
});
|
|
pro.setZjlgcs(zjlgcs.toString());
|
|
pro.setYzxmjl(yzxmjl.toString());
|
|
pro.setSgxmjl(sgxmjl.toString());
|
|
}
|
|
List<String> numList = mapper.getClassPeople(pro.getBidCode());
|
|
List<String> weekList = mapper.getWeekList(pro.getBidCode());
|
|
pro.setTzNum(numList.get(0));
|
|
pro.setYzNum(numList.get(1));
|
|
pro.setEjfxNum(numList.get(2));
|
|
pro.setSjfxNum(numList.get(3));
|
|
pro.setFffNum(numList.get(4));
|
|
pro.setWjfxNum(numList.get(5));
|
|
pro.setTeamNum(numList.get(6));
|
|
pro.setWzNum(numList.get(7));
|
|
//周
|
|
pro.setWejfxNum(weekList.get(0));
|
|
pro.setWsjfxNum(weekList.get(1));
|
|
pro.setWfffNum(weekList.get(2));
|
|
pro.setWwjfxNum(weekList.get(3));
|
|
pro.setPNum(weekList.get(4));
|
|
|
|
}
|
|
}catch (Exception e){
|
|
log.error(e.toString(),e);
|
|
}
|
|
return pro;
|
|
}
|
|
|
|
/**
|
|
* 施工班组查询
|
|
* @param proData
|
|
* @return
|
|
*/
|
|
@Override
|
|
public PageInfo<ProData> getProWorkTeam(ProData proData) {
|
|
if (StringUtils.isNotBlank(proData.getBuildCode())) {
|
|
String[] buildCodeArr = proData.getBuildCode().split(",");
|
|
List<String> buildCodeList = Arrays.asList(buildCodeArr);
|
|
proData.setBuildCodeList(buildCodeList);
|
|
}
|
|
List<ProData> list = mapper.getProWorkTeam(proData);
|
|
PageInfo<ProData> pageInfo = new PageInfo<>(list);
|
|
return pageInfo;
|
|
}
|
|
|
|
@Override
|
|
public PageInfo<ProClassMettingVo> getClassMettingList(ProClassMettingVo proClassMettingVo) {
|
|
List<ProClassMettingVo> list = mapper.getClassMettingList(proClassMettingVo);
|
|
PageInfo<ProClassMettingVo> pageInfo = new PageInfo<>(list);
|
|
return pageInfo;
|
|
}
|
|
|
|
@Override
|
|
public List<PreservationVo> getProjectPreservation(PreservationVo preservationVo) {
|
|
return mapper.getProjectPreservation(preservationVo);
|
|
}
|
|
|
|
@Override
|
|
public PreservationVo getPreservation(String keyId) {
|
|
try{
|
|
PreservationVo entity=mapper.getPreservation(keyId);
|
|
return entity;
|
|
}catch (Exception e){
|
|
log.error(e.toString(),e);
|
|
}
|
|
return new PreservationVo();
|
|
}
|
|
|
|
@Override
|
|
public ReturnCodeEntity deletePreservation(String keyId) {
|
|
ReturnCodeEntity returnCodeEntity=new ReturnCodeEntity();
|
|
try{
|
|
int num=mapper.deletePreservation(keyId);
|
|
if(num<1){
|
|
returnCodeEntity.setMsg("删除失败,请联系管理员");
|
|
returnCodeEntity.setCode("202");
|
|
return returnCodeEntity;
|
|
}else{
|
|
returnCodeEntity.setMsg("删除成功");
|
|
returnCodeEntity.setCode("200");
|
|
return returnCodeEntity;
|
|
}
|
|
}catch (Exception e){
|
|
returnCodeEntity.setMsg("网络异常,请稍后重试");
|
|
returnCodeEntity.setCode("203");
|
|
}
|
|
return returnCodeEntity;
|
|
}
|
|
|
|
@Override
|
|
public ReturnCodeEntity deleteAllPreservation(PreservationVo preservationVo) {
|
|
ReturnCodeEntity returnCodeEntity=new ReturnCodeEntity();
|
|
try{
|
|
mapper.deleteAllPreservation(preservationVo);
|
|
returnCodeEntity.setMsg("删除成功");
|
|
returnCodeEntity.setCode("200");
|
|
return returnCodeEntity;
|
|
}catch (Exception e){
|
|
returnCodeEntity.setMsg("网络异常,请稍后重试");
|
|
returnCodeEntity.setCode("203");
|
|
}
|
|
return returnCodeEntity;
|
|
}
|
|
|
|
@Override
|
|
public ReturnCodeEntity batchDeletePreservation(List<String> list) {
|
|
ReturnCodeEntity returnCodeEntity=new ReturnCodeEntity();
|
|
try{
|
|
for(int i = 0;i<list.size();i++){
|
|
String keyId = list.get(i);
|
|
mapper.deletePreservation(keyId);
|
|
}
|
|
returnCodeEntity.setMsg("删除成功");
|
|
returnCodeEntity.setCode("200");
|
|
return returnCodeEntity;
|
|
}catch (Exception e){
|
|
returnCodeEntity.setMsg("网络异常,请稍后重试");
|
|
returnCodeEntity.setCode("203");
|
|
}
|
|
return returnCodeEntity;
|
|
}
|
|
|
|
@Override
|
|
public ReturnCodeEntity insertPreservation(PreservationVo preservationVo) {
|
|
ReturnCodeEntity returnCodeEntity=new ReturnCodeEntity();
|
|
try{
|
|
int num=mapper.insertPreservation(preservationVo);
|
|
if(num<1){
|
|
returnCodeEntity.setMsg("添加失败,请联系管理员");
|
|
returnCodeEntity.setCode("202");
|
|
return returnCodeEntity;
|
|
}else{
|
|
returnCodeEntity.setMsg("添加成功");
|
|
returnCodeEntity.setCode("200");
|
|
return returnCodeEntity;
|
|
}
|
|
}catch (Exception e){
|
|
returnCodeEntity.setMsg("网络异常,请稍后重试");
|
|
returnCodeEntity.setCode("203");
|
|
}
|
|
return returnCodeEntity;
|
|
}
|
|
|
|
@Override
|
|
public ReturnCodeEntity updatePreservation(PreservationVo preservationVo) {
|
|
ReturnCodeEntity returnCodeEntity=new ReturnCodeEntity();
|
|
try{
|
|
int num4=mapper.updatePreservation(preservationVo);
|
|
if(num4<1){
|
|
returnCodeEntity.setMsg("修改失败,请联系管理员");
|
|
returnCodeEntity.setCode("202");
|
|
return returnCodeEntity;
|
|
}else{
|
|
returnCodeEntity.setMsg("修改成功");
|
|
returnCodeEntity.setCode("200");
|
|
return returnCodeEntity;
|
|
}
|
|
}catch (Exception e){
|
|
log.error(e.toString());
|
|
returnCodeEntity.setMsg("网络异常,请稍后重试");
|
|
returnCodeEntity.setCode("203");
|
|
}
|
|
return returnCodeEntity;
|
|
}
|
|
|
|
@Override
|
|
public void addImportData(List<PreservationVo > list) {
|
|
mapper.addImportData(list);
|
|
}
|
|
|
|
}
|