Browse Source

修改,上下架

feature/teamB_zz_wgh
zxc 3 years ago
parent
commit
c5149b3f9d
  1. 9
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/ServiceProjectFormDTO.java
  2. 26
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcServiceProjectController.java
  3. 13
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcServiceProjectAttachmentDao.java
  4. 9
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcServiceProjectDao.java
  5. 16
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcServiceProjectService.java
  6. 71
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcServiceProjectServiceImpl.java
  7. 6
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcServiceProjectAttachmentDao.xml
  8. 10
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcServiceProjectDao.xml

9
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/ServiceProjectFormDTO.java

@ -3,7 +3,6 @@ package com.epmet.dto.form;
import com.epmet.dto.IcServiceProjectAttachmentDTO;
import lombok.Data;
import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.util.List;
@ -19,14 +18,15 @@ public class ServiceProjectFormDTO implements Serializable {
private static final long serialVersionUID = -4573264697450644498L;
public interface ServiceProjectAddForm{}
public interface ServiceProjectUpdateForm{}
@NotBlank(message = "服务类别不能为空",groups = {ServiceProjectAddForm.class})
private String serviceCategoryKey;
@NotBlank(message = "服务名称不能为空",groups = {ServiceProjectAddForm.class})
@NotBlank(message = "服务名称不能为空",groups = {ServiceProjectAddForm.class,ServiceProjectUpdateForm.class})
private String serviceName;
@NotBlank(message = "服务内容不能为空",groups = {ServiceProjectAddForm.class})
@NotBlank(message = "服务内容不能为空",groups = {ServiceProjectAddForm.class,ServiceProjectUpdateForm.class})
private String serviceContent;
/**
@ -43,6 +43,9 @@ public class ServiceProjectFormDTO implements Serializable {
private String userId;
@NotBlank(message = "serviceProjectId不能为空",groups = {ServiceProjectUpdateForm.class})
private String serviceProjectId;
/**
* 附件集合
*/

26
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcServiceProjectController.java

@ -103,4 +103,30 @@ public class IcServiceProjectController {
return new Result<PageData>().ok(icServiceProjectService.serviceProjectList(formDTO));
}
/**
* Desc: 修改服务项目
* @param formDTO
* @author zxc
* @date 2022/5/30 09:36
*/
@PostMapping("serviceProjectEdit")
public Result serviceProjectEdit(@RequestBody ServiceProjectFormDTO formDTO,@LoginUser TokenDto tokenDto){
ValidatorUtils.validateEntity(formDTO, ServiceProjectFormDTO.ServiceProjectUpdateForm.class);
formDTO.setCustomerId(tokenDto.getCustomerId());
icServiceProjectService.serviceProjectEdit(formDTO);
return new Result();
}
/**
* Desc: 上下架服务项目
* @param ids
* @author zxc
* @date 2022/5/30 10:17
*/
@PostMapping("serviceProjectEnabled")
public Result serviceProjectEnabled(@RequestBody List<String> ids){
icServiceProjectService.serviceProjectEnabled(ids);
return new Result();
}
}

13
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcServiceProjectAttachmentDao.java

@ -3,6 +3,9 @@ package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.entity.IcServiceProjectAttachmentEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 事件附件表
@ -12,5 +15,13 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface IcServiceProjectAttachmentDao extends BaseDao<IcServiceProjectAttachmentEntity> {
/**
* Desc: 根据服务项目ID删除附件
* @param id
* @author zxc
* @date 2022/5/30 09:50
*/
void delAttachmentByServiceProjectId(@Param("id")String id);
}

9
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcServiceProjectDao.java

@ -5,6 +5,7 @@ import com.epmet.dto.form.ServiceProjectListFormDTO;
import com.epmet.dto.result.ServiceProjectListResultDTO;
import com.epmet.entity.IcServiceProjectEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -25,4 +26,12 @@ public interface IcServiceProjectDao extends BaseDao<IcServiceProjectEntity> {
*/
List<ServiceProjectListResultDTO> getServiceProjectList(ServiceProjectListFormDTO formDTO);
/**
* Desc: 上下架服务项目
* @param ids
* @author zxc
* @date 2022/5/30 10:17
*/
void serviceProjectEnabled(@Param("ids") List<String> ids);
}

16
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcServiceProjectService.java

@ -94,4 +94,20 @@ public interface IcServiceProjectService extends BaseService<IcServiceProjectEnt
*/
PageData serviceProjectList(ServiceProjectListFormDTO formDTO);
/**
* Desc: 修改服务项目
* @param formDTO
* @author zxc
* @date 2022/5/30 09:36
*/
void serviceProjectEdit(ServiceProjectFormDTO formDTO);
/**
* Desc: 上下架服务项目
* @param ids
* @author zxc
* @date 2022/5/30 10:17
*/
void serviceProjectEnabled(List<String> ids);
}

71
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcServiceProjectServiceImpl.java

@ -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);
}
}

6
epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcServiceProjectAttachmentDao.xml

@ -3,5 +3,9 @@
<mapper namespace="com.epmet.dao.IcServiceProjectAttachmentDao">
<!--根据服务项目IDs删除附件-->
<delete id="delAttachmentByServiceProjectId">
DELETE FROM ic_service_project_attachment
WHERE IC_SERVICE_ID = #{id}
</delete>
</mapper>

10
epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcServiceProjectDao.xml

@ -3,6 +3,16 @@
<mapper namespace="com.epmet.dao.IcServiceProjectDao">
<!-- 上下架【服务项目】 -->
<update id="serviceProjectEnabled">
UPDATE ic_service_project
SET ENABLED = 1,
UPDATED_TIME = NOW()
WHERE ID IN (
<foreach collection="ids" item="id" separator=",">#{id}</foreach>
)
</update>
<!-- 查询服务项目列表 -->
<resultMap id="getServiceProjectListMap" type="com.epmet.dto.result.ServiceProjectListResultDTO">
<result column="serviceProjectId" property="serviceProjectId"/>

Loading…
Cancel
Save