23 changed files with 765 additions and 27 deletions
@ -0,0 +1,49 @@ |
|||
package com.epmet.dto.form; |
|||
|
|||
|
|||
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; |
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import lombok.Data; |
|||
import org.springframework.format.annotation.DateTimeFormat; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import javax.validation.constraints.NotNull; |
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* 【服务项目记录】修改 |
|||
*/ |
|||
@Data |
|||
public class IcServiceEditFormDTO implements Serializable { |
|||
public interface AddUserInternalGroup { |
|||
} |
|||
|
|||
public interface AddUserShowGroup extends CustomerClientShowGroup { |
|||
} |
|||
|
|||
@NotBlank(message = "", groups = AddUserInternalGroup.class) |
|||
private String serviceRecordId; |
|||
private String principalName; |
|||
private String principalContact; |
|||
/** |
|||
* 服务时间 |
|||
*/ |
|||
@NotNull(message = "起始服务时间不能为空", groups = AddUserShowGroup.class) |
|||
@DateTimeFormat(pattern = "yyyy-MM-dd") |
|||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") |
|||
private Date serviceTimeStart; |
|||
|
|||
/** |
|||
* 服务截止时间 |
|||
*/ |
|||
@NotNull(message = "截止服务时间不能为空", groups = AddUserShowGroup.class) |
|||
@DateTimeFormat(pattern = "yyyy-MM-dd") |
|||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") |
|||
private Date serviceTimeEnd; |
|||
|
|||
/** |
|||
* 备注 |
|||
*/ |
|||
private String remark; |
|||
} |
@ -0,0 +1,24 @@ |
|||
package com.epmet.dto.result; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @Description 【组织】服务组织列表_下拉框使用--接口返参 |
|||
* @Author sun |
|||
*/ |
|||
@Data |
|||
public class IcServiceOrgSelectListResultDTO implements Serializable { |
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 服务组织Id |
|||
*/ |
|||
private String icServiceOrgId; |
|||
/** |
|||
* 服务组织名称 |
|||
*/ |
|||
private String orgName; |
|||
|
|||
} |
@ -0,0 +1,81 @@ |
|||
package com.epmet.dto.result; |
|||
|
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
import java.util.List; |
|||
|
|||
@Data |
|||
public class IcServiceRecDetailRes implements Serializable { |
|||
|
|||
|
|||
/** |
|||
* 联系方式 |
|||
*/ |
|||
private String principalContact; |
|||
|
|||
/** |
|||
* 经办人姓名 |
|||
*/ |
|||
private String principalName; |
|||
|
|||
/** |
|||
* 备注 |
|||
*/ |
|||
private String remark; |
|||
|
|||
/** |
|||
* 服务类别ID |
|||
*/ |
|||
private String serviceCategoryKey; |
|||
|
|||
/** |
|||
* 服务类别ID |
|||
*/ |
|||
private String serviceCategoryName; |
|||
|
|||
/** |
|||
* 服务组织ID |
|||
*/ |
|||
private String serviceOrgId; |
|||
|
|||
/** |
|||
* 服务组织名称 |
|||
*/ |
|||
private String serviceOrgName; |
|||
|
|||
/** |
|||
* 服务项目ID |
|||
*/ |
|||
private String serviceProjectId; |
|||
|
|||
/** |
|||
* 服务项目名称 |
|||
*/ |
|||
private String serviceProjectName; |
|||
|
|||
/** |
|||
* 服务时间 |
|||
*/ |
|||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") |
|||
private Date serviceTimeStart; |
|||
|
|||
/** |
|||
* 服务截止时间 |
|||
*/ |
|||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") |
|||
private Date serviceTimeEnd; |
|||
|
|||
/** |
|||
* in_service服务中;completed:已完成 |
|||
*/ |
|||
private String serviceStatus; |
|||
|
|||
/** |
|||
* 发布范围 |
|||
*/ |
|||
private List<IcServiceScopeDTO> serviceScope; |
|||
|
|||
} |
@ -0,0 +1,15 @@ |
|||
package com.epmet.dto.result; |
|||
|
|||
|
|||
import lombok.Data; |
|||
|
|||
@Data |
|||
public class IcServiceScopeDTO { |
|||
private String objectId; |
|||
private String objectName; |
|||
private String objectType; |
|||
/** |
|||
* 发布范围的组织ID PATH |
|||
*/ |
|||
private String objectIdPath; |
|||
} |
@ -0,0 +1,16 @@ |
|||
package com.epmet.dao; |
|||
|
|||
import com.epmet.commons.mybatis.dao.BaseDao; |
|||
import com.epmet.entity.IcServiceRecordEntity; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
|
|||
/** |
|||
* |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2022-05-30 |
|||
*/ |
|||
@Mapper |
|||
public interface IcServiceRecordDao extends BaseDao<IcServiceRecordEntity> { |
|||
|
|||
} |
@ -0,0 +1,23 @@ |
|||
package com.epmet.dao; |
|||
|
|||
import com.epmet.commons.mybatis.dao.BaseDao; |
|||
import com.epmet.dto.result.IcServiceScopeDTO; |
|||
import com.epmet.entity.IcServiceScopeEntity; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
import org.apache.ibatis.annotations.Param; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2022-05-30 |
|||
*/ |
|||
@Mapper |
|||
public interface IcServiceScopeDao extends BaseDao<IcServiceScopeEntity> { |
|||
|
|||
int update(@Param("serviceId") String serviceId, @Param("userId") String userId); |
|||
|
|||
List<IcServiceScopeDTO> selectList(String serviceRecordId); |
|||
} |
@ -0,0 +1,79 @@ |
|||
package com.epmet.entity; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
|
|||
import com.epmet.commons.mybatis.entity.BaseEpmetEntity; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
|
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2022-05-30 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper=false) |
|||
@TableName("ic_service_record") |
|||
public class IcServiceRecordEntity extends BaseEpmetEntity { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 服务类别ID |
|||
*/ |
|||
private String serviceCategoryKey; |
|||
|
|||
/** |
|||
* 服务项目ID |
|||
*/ |
|||
private String serviceProjectId; |
|||
|
|||
/** |
|||
* 服务项目名称 |
|||
*/ |
|||
private String serviceProjectName; |
|||
|
|||
/** |
|||
* 服务组织ID |
|||
*/ |
|||
private String serviceOrgId; |
|||
|
|||
/** |
|||
* 服务组织名称 |
|||
*/ |
|||
private String serviceOrgName; |
|||
|
|||
/** |
|||
* 经办人姓名 |
|||
*/ |
|||
private String principalName; |
|||
|
|||
/** |
|||
* 联系方式 |
|||
*/ |
|||
private String principalContact; |
|||
|
|||
/** |
|||
* 服务时间 |
|||
*/ |
|||
private Date serviceTimeStart; |
|||
|
|||
/** |
|||
* 服务截止时间 |
|||
*/ |
|||
private Date serviceTimeEnd; |
|||
|
|||
/** |
|||
* in_service服务中;completed:已完成 |
|||
*/ |
|||
private String serviceStatus; |
|||
|
|||
/** |
|||
* 备注 |
|||
*/ |
|||
private String remark; |
|||
|
|||
} |
@ -0,0 +1,69 @@ |
|||
package com.epmet.entity; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
|
|||
import com.epmet.commons.mybatis.entity.BaseEpmetEntity; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
|
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2022-05-30 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper=false) |
|||
@TableName("ic_service_scope") |
|||
public class IcServiceScopeEntity extends BaseEpmetEntity { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 服务类别ID |
|||
*/ |
|||
private String serviceCategoryKey; |
|||
|
|||
/** |
|||
* 服务项目ID |
|||
*/ |
|||
private String serviceProjectId; |
|||
|
|||
/** |
|||
* 服务组织ID |
|||
*/ |
|||
private String serviceOrgId; |
|||
|
|||
/** |
|||
* 服务记录的ID |
|||
*/ |
|||
private String serviceRecordId; |
|||
|
|||
/** |
|||
* agency单位;grid网格;neighborhood小区 |
|||
*/ |
|||
private String objectType; |
|||
|
|||
/** |
|||
* 选中的组织的ID |
|||
*/ |
|||
private String objectId; |
|||
|
|||
/** |
|||
* 发布范围的组织ID PATH |
|||
*/ |
|||
private String objectIdPath; |
|||
|
|||
/** |
|||
* |
|||
*/ |
|||
private String objectName; |
|||
|
|||
/** |
|||
* 备注 |
|||
*/ |
|||
private String remark; |
|||
|
|||
} |
@ -0,0 +1,35 @@ |
|||
package com.epmet.service; |
|||
|
|||
import com.epmet.commons.mybatis.service.BaseService; |
|||
import com.epmet.dto.form.IcServiceEditFormDTO; |
|||
import com.epmet.dto.result.IcServiceRecDetailRes; |
|||
import com.epmet.entity.IcServiceRecordEntity; |
|||
|
|||
/** |
|||
* |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2022-05-30 |
|||
*/ |
|||
public interface IcServiceRecordService extends BaseService<IcServiceRecordEntity> { |
|||
|
|||
/** |
|||
* http://yapi.elinkservice.cn/project/245/interface/api/7820
|
|||
* @param serviceId |
|||
* 【服务项目记录】取消:进行中的项目可以取消。删除该记录 |
|||
*/ |
|||
void cancelService(String serviceId,String userId); |
|||
|
|||
/** |
|||
* 【服务项目记录】详情 |
|||
* @param serviceId |
|||
* @return |
|||
*/ |
|||
IcServiceRecDetailRes queryServiceDetail(String serviceId); |
|||
|
|||
/** |
|||
* 【服务项目记录】修改 |
|||
* @param formDTO |
|||
*/ |
|||
void updateServiceRecord(IcServiceEditFormDTO formDTO); |
|||
} |
@ -0,0 +1,14 @@ |
|||
package com.epmet.service; |
|||
|
|||
import com.epmet.commons.mybatis.service.BaseService; |
|||
import com.epmet.entity.IcServiceScopeEntity; |
|||
|
|||
/** |
|||
* |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2022-05-30 |
|||
*/ |
|||
public interface IcServiceScopeService extends BaseService<IcServiceScopeEntity> { |
|||
|
|||
} |
@ -0,0 +1,104 @@ |
|||
package com.epmet.service.impl; |
|||
|
|||
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
|||
import com.epmet.commons.tools.enums.DictTypeEnum; |
|||
import com.epmet.commons.tools.exception.EpmetErrorCode; |
|||
import com.epmet.commons.tools.exception.EpmetException; |
|||
import com.epmet.commons.tools.utils.ConvertUtils; |
|||
import com.epmet.commons.tools.utils.Result; |
|||
import com.epmet.dao.IcServiceRecordDao; |
|||
import com.epmet.dao.IcServiceScopeDao; |
|||
import com.epmet.dto.form.IcServiceEditFormDTO; |
|||
import com.epmet.dto.result.IcServiceRecDetailRes; |
|||
import com.epmet.entity.IcServiceRecordEntity; |
|||
import com.epmet.feign.EpmetAdminOpenFeignClient; |
|||
import com.epmet.service.IcServiceRecordService; |
|||
import org.apache.commons.collections4.MapUtils; |
|||
import org.apache.commons.lang3.StringUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
|
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2022-05-30 |
|||
*/ |
|||
@Service |
|||
public class IcServiceRecordServiceImpl extends BaseServiceImpl<IcServiceRecordDao, IcServiceRecordEntity> implements IcServiceRecordService { |
|||
@Autowired |
|||
private IcServiceScopeDao icServiceScopeDao; |
|||
@Autowired |
|||
private EpmetAdminOpenFeignClient adminOpenFeignClient; |
|||
/** |
|||
* http://yapi.elinkservice.cn/project/245/interface/api/7820
|
|||
* |
|||
* @param serviceId 【服务项目记录】取消:进行中的项目可以取消。删除该记录 |
|||
*/ |
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void cancelService(String serviceId,String userId) { |
|||
IcServiceRecordEntity icServiceRecordEntity = baseDao.selectById(serviceId); |
|||
if (null == icServiceRecordEntity) { |
|||
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),String.format("服务记录不存在,serviceId:%s",serviceId),"服务记录不存在"); |
|||
} |
|||
if (!"in_service".equals(icServiceRecordEntity.getServiceStatus())) { |
|||
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), String.format("服务状态:%s", icServiceRecordEntity.getServiceStatus()), "只有服务中的项目可以取消"); |
|||
} |
|||
baseDao.deleteById(serviceId); |
|||
icServiceScopeDao.update(serviceId,userId); |
|||
} |
|||
|
|||
/** |
|||
* 【服务项目记录】详情 |
|||
* |
|||
* @param serviceId |
|||
* @return |
|||
*/ |
|||
@Override |
|||
public IcServiceRecDetailRes queryServiceDetail(String serviceId) { |
|||
IcServiceRecordEntity icServiceRecordEntity = baseDao.selectById(serviceId); |
|||
IcServiceRecDetailRes res = ConvertUtils.sourceToTarget(icServiceRecordEntity, IcServiceRecDetailRes.class); |
|||
if (null != res) { |
|||
res.setServiceScope(icServiceScopeDao.selectList(serviceId)); |
|||
//服务分类名称
|
|||
Result<Map<String, String>> icServiceTypeMapRes = adminOpenFeignClient.dictMap(DictTypeEnum.IC_SERVICE_TYPE.getCode()); |
|||
if (!icServiceTypeMapRes.success() || MapUtils.isEmpty(icServiceTypeMapRes.getData())) { |
|||
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "服务分类字典查询异常"); |
|||
} |
|||
res.setServiceCategoryName(icServiceTypeMapRes.getData().get(res.getServiceCategoryKey())); |
|||
} |
|||
return res; |
|||
} |
|||
|
|||
/** |
|||
* 【服务项目记录】修改 |
|||
* |
|||
* @param formDTO |
|||
*/ |
|||
@Transactional(rollbackFor = Exception.class) |
|||
@Override |
|||
public void updateServiceRecord(IcServiceEditFormDTO formDTO) { |
|||
IcServiceRecordEntity icServiceRecordEntity = baseDao.selectById(formDTO.getServiceRecordId()); |
|||
if (null == icServiceRecordEntity) { |
|||
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),String.format("服务记录不存在,serviceRecordId:%s",formDTO.getServiceRecordId()),"服务记录不存在"); |
|||
} |
|||
icServiceRecordEntity.setServiceTimeStart(formDTO.getServiceTimeStart()); |
|||
icServiceRecordEntity.setServiceTimeEnd(formDTO.getServiceTimeEnd()); |
|||
if(StringUtils.isNotBlank(formDTO.getPrincipalContact())){ |
|||
icServiceRecordEntity.setPrincipalContact(formDTO.getPrincipalContact()); |
|||
} |
|||
if(StringUtils.isNotBlank(formDTO.getPrincipalName())){ |
|||
icServiceRecordEntity.setPrincipalName(formDTO.getPrincipalName()); |
|||
} |
|||
if(StringUtils.isNotBlank(formDTO.getRemark())){ |
|||
icServiceRecordEntity.setRemark(formDTO.getRemark()); |
|||
} |
|||
baseDao.updateById(icServiceRecordEntity); |
|||
} |
|||
|
|||
|
|||
} |
@ -0,0 +1,19 @@ |
|||
package com.epmet.service.impl; |
|||
|
|||
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
|||
import com.epmet.dao.IcServiceScopeDao; |
|||
import com.epmet.entity.IcServiceScopeEntity; |
|||
import com.epmet.service.IcServiceScopeService; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
/** |
|||
* |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2022-05-30 |
|||
*/ |
|||
@Service |
|||
public class IcServiceScopeServiceImpl extends BaseServiceImpl<IcServiceScopeDao, IcServiceScopeEntity> implements IcServiceScopeService { |
|||
|
|||
|
|||
} |
@ -0,0 +1,28 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
|
|||
<mapper namespace="com.epmet.dao.IcServiceRecordDao"> |
|||
|
|||
<resultMap type="com.epmet.entity.IcServiceRecordEntity" id="icServiceRecordMap"> |
|||
<result property="id" column="ID"/> |
|||
<result property="serviceCategoryId" column="SERVICE_CATEGORY_ID"/> |
|||
<result property="serviceProjectId" column="SERVICE_PROJECT_ID"/> |
|||
<result property="serviceProjectName" column="SERVICE_PROJECT_NAME"/> |
|||
<result property="serviceOrgId" column="SERVICE_ORG_ID"/> |
|||
<result property="serviceOrgName" column="SERVICE_ORG_NAME"/> |
|||
<result property="principalName" column="PRINCIPAL_NAME"/> |
|||
<result property="principalContact" column="PRINCIPAL_CONTACT"/> |
|||
<result property="serviceTimeStart" column="SERVICE_TIME_START"/> |
|||
<result property="serviceTimeEnd" column="SERVICE_TIME_END"/> |
|||
<result property="serviceStatus" column="SERVICE_STATUS"/> |
|||
<result property="remark" column="REMARK"/> |
|||
<result property="revision" column="REVISION"/> |
|||
<result property="createdBy" column="CREATED_BY"/> |
|||
<result property="createdTime" column="CREATED_TIME"/> |
|||
<result property="updatedBy" column="UPDATED_BY"/> |
|||
<result property="updatedTime" column="UPDATED_TIME"/> |
|||
<result property="delFlag" column="DEL_FLAG"/> |
|||
</resultMap> |
|||
|
|||
|
|||
</mapper> |
@ -0,0 +1,42 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
|
|||
<mapper namespace="com.epmet.dao.IcServiceScopeDao"> |
|||
|
|||
<resultMap type="com.epmet.entity.IcServiceScopeEntity" id="icServiceScopeMap"> |
|||
<result property="id" column="ID"/> |
|||
<result property="serviceCategoryId" column="SERVICE_CATEGORY_ID"/> |
|||
<result property="serviceProjectId" column="SERVICE_PROJECT_ID"/> |
|||
<result property="serviceOrgId" column="SERVICE_ORG_ID"/> |
|||
<result property="serviceRecordId" column="SERVICE_RECORD_ID"/> |
|||
<result property="objectType" column="OBJECT_TYPE"/> |
|||
<result property="objectId" column="OBJECT_ID"/> |
|||
<result property="objectIdPath" column="OBJECT_ID_PATH"/> |
|||
<result property="objectName" column="OBJECT_NAME"/> |
|||
<result property="remark" column="REMARK"/> |
|||
<result property="revision" column="REVISION"/> |
|||
<result property="createdBy" column="CREATED_BY"/> |
|||
<result property="createdTime" column="CREATED_TIME"/> |
|||
<result property="updatedBy" column="UPDATED_BY"/> |
|||
<result property="updatedTime" column="UPDATED_TIME"/> |
|||
<result property="delFlag" column="DEL_FLAG"/> |
|||
</resultMap> |
|||
|
|||
<update id="update" parameterType="map"> |
|||
update ic_service_scope set del_flag='1',UPDATED_TIME=now(),UPDATED_BY=#{userId} |
|||
where SERVICE_RECORD_ID=#{serviceId} |
|||
</update> |
|||
|
|||
<select id="selectList" parameterType="java.lang.String" resultType="com.epmet.dto.result.IcServiceScopeDTO"> |
|||
SELECT |
|||
s.OBJECT_ID, |
|||
s.OBJECT_TYPE, |
|||
s.OBJECT_NAME, |
|||
s.OBJECT_ID_PATH |
|||
FROM |
|||
ic_service_scope s |
|||
WHERE |
|||
s.DEL_FLAG = '0' |
|||
AND s.SERVICE_RECORD_ID = #{serviceRecordId} |
|||
</select> |
|||
</mapper> |
Loading…
Reference in new issue