|
@ -3,14 +3,23 @@ package com.epmet.service.impl; |
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
|
|
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
|
|
|
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
|
|
|
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; |
|
|
|
|
|
import com.epmet.commons.tools.exception.EpmetException; |
|
|
import com.epmet.commons.tools.page.PageData; |
|
|
import com.epmet.commons.tools.page.PageData; |
|
|
|
|
|
import com.epmet.commons.tools.redis.common.CustomerOrgRedis; |
|
|
|
|
|
import com.epmet.commons.tools.redis.common.CustomerStaffRedis; |
|
|
|
|
|
import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache; |
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
import com.epmet.commons.tools.constant.FieldConstant; |
|
|
import com.epmet.commons.tools.constant.FieldConstant; |
|
|
import com.epmet.dao.IcServiceProjectDao; |
|
|
import com.epmet.dao.IcServiceProjectDao; |
|
|
import com.epmet.dto.IcServiceProjectDTO; |
|
|
import com.epmet.dto.IcServiceProjectDTO; |
|
|
|
|
|
import com.epmet.dto.form.ServiceProjectFormDTO; |
|
|
|
|
|
import com.epmet.entity.IcServiceProjectAttachmentEntity; |
|
|
import com.epmet.entity.IcServiceProjectEntity; |
|
|
import com.epmet.entity.IcServiceProjectEntity; |
|
|
import com.epmet.redis.IcServiceProjectRedis; |
|
|
import com.epmet.service.IcServiceProjectAttachmentService; |
|
|
import com.epmet.service.IcServiceProjectService; |
|
|
import com.epmet.service.IcServiceProjectService; |
|
|
|
|
|
import org.apache.commons.collections4.CollectionUtils; |
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.stereotype.Service; |
|
@ -30,7 +39,7 @@ import java.util.Map; |
|
|
public class IcServiceProjectServiceImpl extends BaseServiceImpl<IcServiceProjectDao, IcServiceProjectEntity> implements IcServiceProjectService { |
|
|
public class IcServiceProjectServiceImpl extends BaseServiceImpl<IcServiceProjectDao, IcServiceProjectEntity> implements IcServiceProjectService { |
|
|
|
|
|
|
|
|
@Autowired |
|
|
@Autowired |
|
|
private IcServiceProjectRedis icServiceProjectRedis; |
|
|
private IcServiceProjectAttachmentService attachmentService; |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public PageData<IcServiceProjectDTO> page(Map<String, Object> params) { |
|
|
public PageData<IcServiceProjectDTO> page(Map<String, Object> params) { |
|
@ -84,4 +93,41 @@ public class IcServiceProjectServiceImpl extends BaseServiceImpl<IcServiceProjec |
|
|
baseDao.deleteBatchIds(Arrays.asList(ids)); |
|
|
baseDao.deleteBatchIds(Arrays.asList(ids)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* Desc: 服务项目新增 |
|
|
|
|
|
* @param formDTO |
|
|
|
|
|
* @author zxc |
|
|
|
|
|
* @date 2022/5/27 16:04 |
|
|
|
|
|
*/ |
|
|
|
|
|
@Override |
|
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
|
|
public void serviceProjectAdd(ServiceProjectFormDTO formDTO) { |
|
|
|
|
|
IcServiceProjectEntity entity = ConvertUtils.sourceToTarget(formDTO, IcServiceProjectEntity.class); |
|
|
|
|
|
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getUserId()); |
|
|
|
|
|
if (null == staffInfo){ |
|
|
|
|
|
throw new EpmetException("未查询到此工作人员"+formDTO.getUserId()); |
|
|
|
|
|
} |
|
|
|
|
|
AgencyInfoCache agencyInfo = CustomerOrgRedis.getAgencyInfo(staffInfo.getAgencyId()); |
|
|
|
|
|
if (null == agencyInfo){ |
|
|
|
|
|
throw new EpmetException("未查询到此组织信息"+staffInfo.getStaffId()); |
|
|
|
|
|
} |
|
|
|
|
|
entity.setEnabled(NumConstant.ZERO); |
|
|
|
|
|
entity.setAgencyId(staffInfo.getAgencyId()); |
|
|
|
|
|
entity.setPid(agencyInfo.getPid()); |
|
|
|
|
|
entity.setAgencyIdPath((StringUtils.isBlank(agencyInfo.getPids()) || agencyInfo.getPids().equals(NumConstant.ZERO_STR)) ? staffInfo.getAgencyId() : agencyInfo.getPids().concat(":").concat(staffInfo.getAgencyId())); |
|
|
|
|
|
baseDao.insert(entity); |
|
|
|
|
|
if (CollectionUtils.isNotEmpty(formDTO.getAttachmentList())){ |
|
|
|
|
|
List<IcServiceProjectAttachmentEntity> entities = ConvertUtils.sourceToTarget(formDTO.getAttachmentList(), IcServiceProjectAttachmentEntity.class); |
|
|
|
|
|
Integer sort = NumConstant.ZERO; |
|
|
|
|
|
for (IcServiceProjectAttachmentEntity e : entities) { |
|
|
|
|
|
e.setCustomerId(formDTO.getCustomerId()); |
|
|
|
|
|
e.setStatus("auto_passed"); |
|
|
|
|
|
e.setSort(sort); |
|
|
|
|
|
e.setIcServiceId(entity.getId()); |
|
|
|
|
|
sort++; |
|
|
|
|
|
} |
|
|
|
|
|
attachmentService.insertBatch(entities); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |