|
|
@ -1,5 +1,6 @@ |
|
|
|
package com.epmet.service.impl; |
|
|
|
|
|
|
|
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.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
|
|
@ -15,7 +16,9 @@ import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache; |
|
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
|
import com.epmet.commons.tools.constant.FieldConstant; |
|
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
|
import com.epmet.dao.IcServiceProjectAttachmentDao; |
|
|
|
import com.epmet.dao.IcServiceProjectDao; |
|
|
|
import com.epmet.dto.IcServiceProjectAttachmentDTO; |
|
|
|
import com.epmet.dto.IcServiceProjectDTO; |
|
|
|
import com.epmet.dto.form.ServiceProjectFormDTO; |
|
|
|
import com.epmet.dto.form.ServiceProjectListFormDTO; |
|
|
@ -50,6 +53,8 @@ public class IcServiceProjectServiceImpl extends BaseServiceImpl<IcServiceProjec |
|
|
|
@Autowired |
|
|
|
private IcServiceProjectAttachmentService attachmentService; |
|
|
|
@Autowired |
|
|
|
private IcServiceProjectAttachmentDao attachmentDao; |
|
|
|
@Autowired |
|
|
|
private EpmetAdminOpenFeignClient adminOpenFeignClient; |
|
|
|
|
|
|
|
@Override |
|
|
@ -128,16 +133,7 @@ public class IcServiceProjectServiceImpl extends BaseServiceImpl<IcServiceProjec |
|
|
|
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); |
|
|
|
disposeAttachment(formDTO.getAttachmentList(), formDTO.getCustomerId(), entity.getId()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@ -172,4 +168,59 @@ public class IcServiceProjectServiceImpl extends BaseServiceImpl<IcServiceProjec |
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* Desc: 修改【服务项目】 |
|
|
|
* @param formDTO |
|
|
|
* @author zxc |
|
|
|
* @date 2022/5/30 09:36 |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void serviceProjectEdit(ServiceProjectFormDTO formDTO) { |
|
|
|
LambdaQueryWrapper<IcServiceProjectEntity> qw = new LambdaQueryWrapper<>(); |
|
|
|
qw.eq(IcServiceProjectEntity::getId,formDTO.getServiceProjectId()); |
|
|
|
IcServiceProjectEntity entity = ConvertUtils.sourceToTarget(formDTO, IcServiceProjectEntity.class); |
|
|
|
baseDao.update(entity,qw); |
|
|
|
if (CollectionUtils.isNotEmpty(formDTO.getAttachmentList())){ |
|
|
|
// 先删后增
|
|
|
|
attachmentDao.delAttachmentByServiceProjectId(formDTO.getServiceProjectId()); |
|
|
|
disposeAttachment(formDTO.getAttachmentList(), formDTO.getCustomerId(), formDTO.getServiceProjectId()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* Desc: 上下架【服务项目】 |
|
|
|
* @param ids |
|
|
|
* @author zxc |
|
|
|
* @date 2022/5/30 10:17 |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void serviceProjectEnabled(List<String> ids) { |
|
|
|
if (CollectionUtils.isNotEmpty(ids)){ |
|
|
|
baseDao.serviceProjectEnabled(ids); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* Desc: 附件处理 |
|
|
|
* @param attachmentList |
|
|
|
* @param customerId |
|
|
|
* @param serviceId |
|
|
|
* @author zxc |
|
|
|
* @date 2022/5/30 10:17 |
|
|
|
*/ |
|
|
|
public void disposeAttachment(List<IcServiceProjectAttachmentDTO> attachmentList,String customerId,String serviceId){ |
|
|
|
List<IcServiceProjectAttachmentEntity> entities = ConvertUtils.sourceToTarget(attachmentList, IcServiceProjectAttachmentEntity.class); |
|
|
|
Integer sort = NumConstant.ZERO; |
|
|
|
for (IcServiceProjectAttachmentEntity e : entities) { |
|
|
|
e.setCustomerId(customerId); |
|
|
|
e.setStatus("auto_passed"); |
|
|
|
e.setSort(sort); |
|
|
|
e.setIcServiceId(serviceId); |
|
|
|
sort++; |
|
|
|
} |
|
|
|
attachmentService.insertBatch(entities); |
|
|
|
} |
|
|
|
|
|
|
|
} |