Browse Source

修改

dev_shibei_match
zxc 4 years ago
parent
commit
b345fa58a7
  1. 83
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/EditCommunitySelfOrganizationFormDTO.java
  2. 15
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcCommunitySelfOrganizationController.java
  3. 5
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcCommunitySelfOrganizationDao.java
  4. 11
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcCommunitySelfOrganizationPersonnelDao.java
  5. 8
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcCommunitySelfOrganizationPersonnelService.java
  6. 10
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcCommunitySelfOrganizationService.java
  7. 11
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcCommunitySelfOrganizationPersonnelServiceImpl.java
  8. 49
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcCommunitySelfOrganizationServiceImpl.java
  9. 15
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcCommunitySelfOrganizationDao.xml
  10. 4
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcCommunitySelfOrganizationPersonnelDao.xml

83
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/EditCommunitySelfOrganizationFormDTO.java

@ -0,0 +1,83 @@
package com.epmet.dto.form;
import com.epmet.dto.IcCommunitySelfOrganizationPersonnelDTO;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* @Author zxc
* @DateTime 2021/11/18 5:32 下午
* @DESC
*/
@Data
public class EditCommunitySelfOrganizationFormDTO implements Serializable {
private static final long serialVersionUID = -4990925380900678065L;
public interface EditCommunitySelfOrganizationForm{}
/**
* 组织名称
*/
@NotBlank(message = "organizationName不能为空",groups = EditCommunitySelfOrganizationForm.class)
private String organizationName;
/**
* 组织人数
*/
@NotNull(message = "organizationPersonCount不能为空",groups = EditCommunitySelfOrganizationForm.class)
private Integer organizationPersonCount;
/**
* 负责人姓名
*/
@NotBlank(message = "principalName不能为空",groups = EditCommunitySelfOrganizationForm.class)
private String principalName;
/**
* 负责人电话
*/
@NotBlank(message = "principalPhone不能为空",groups = EditCommunitySelfOrganizationForm.class)
private String principalPhone;
/**
* 服务事项
*/
@NotBlank(message = "serviceItem不能为空",groups = EditCommunitySelfOrganizationForm.class)
private String serviceItem;
/**
* 社区自组织创建时间
*/
@NotNull(message = "organizationCreatedTime不能为空",groups = EditCommunitySelfOrganizationForm.class)
private String organizationCreatedTime;
/**
* 经度
*/
@NotBlank(message = "longitude不能为空",groups = EditCommunitySelfOrganizationForm.class)
private String longitude;
/**
* 纬度
*/
@NotBlank(message = "latitude不能为空",groups = EditCommunitySelfOrganizationForm.class)
private String latitude;
/**
* 社区自组织ID
*/
@NotBlank(message = "orgId不能为空",groups = EditCommunitySelfOrganizationForm.class)
private String orgId;
/**
* 社区自组织人员
*/
private List<IcCommunitySelfOrganizationPersonnelDTO> organizationPersonnel;
}

15
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcCommunitySelfOrganizationController.java

@ -30,6 +30,7 @@ import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.dto.IcCommunitySelfOrganizationDTO;
import com.epmet.dto.form.AddCommunitySelfOrganizationFormDTO;
import com.epmet.dto.form.EditCommunitySelfOrganizationFormDTO;
import com.epmet.excel.IcCommunitySelfOrganizationExcel;
import com.epmet.service.IcCommunitySelfOrganizationService;
import org.springframework.beans.factory.annotation.Autowired;
@ -109,4 +110,18 @@ public class IcCommunitySelfOrganizationController {
return new Result();
}
/**
* @Description 修改社区自组织
* @param tokenDto
* @param formDTO
* @author zxc
* @date 2021/11/19 10:12 上午
*/
@PostMapping("editcommunityselforganization")
public Result editCommunitySelfOrganization(@LoginUser TokenDto tokenDto, @RequestBody EditCommunitySelfOrganizationFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO, EditCommunitySelfOrganizationFormDTO.EditCommunitySelfOrganizationForm.class);
icCommunitySelfOrganizationService.editCommunitySelfOrganization(tokenDto, formDTO);
return new Result();
}
}

5
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcCommunitySelfOrganizationDao.java

@ -18,6 +18,7 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.form.EditCommunitySelfOrganizationFormDTO;
import com.epmet.entity.IcCommunitySelfOrganizationEntity;
import org.apache.ibatis.annotations.Mapper;
@ -29,5 +30,7 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface IcCommunitySelfOrganizationDao extends BaseDao<IcCommunitySelfOrganizationEntity> {
void updateCommunitySelfOrganization(IcCommunitySelfOrganizationEntity formDTO);
}

11
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcCommunitySelfOrganizationPersonnelDao.java

@ -20,6 +20,7 @@ package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.entity.IcCommunitySelfOrganizationPersonnelEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* 社区自组织人员表
@ -29,5 +30,13 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface IcCommunitySelfOrganizationPersonnelDao extends BaseDao<IcCommunitySelfOrganizationPersonnelEntity> {
/**
* @Description 根据社区自组织ID删除
* @param orgId
* @author zxc
* @date 2021/11/19 11:19 上午
*/
void deleteByOrgId(@Param("orgId")String orgId);
}

8
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcCommunitySelfOrganizationPersonnelService.java

@ -92,4 +92,12 @@ public interface IcCommunitySelfOrganizationPersonnelService extends BaseService
* @date 2021-11-18
*/
void delete(String[] ids);
/**
* @Description 根据社区自组织ID删除
* @param orgId
* @author zxc
* @date 2021/11/19 11:18 上午
*/
void deleteByOrgId(String orgId);
}

10
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcCommunitySelfOrganizationService.java

@ -22,6 +22,7 @@ import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.dto.IcCommunitySelfOrganizationDTO;
import com.epmet.dto.form.AddCommunitySelfOrganizationFormDTO;
import com.epmet.dto.form.EditCommunitySelfOrganizationFormDTO;
import com.epmet.entity.IcCommunitySelfOrganizationEntity;
import java.util.List;
@ -103,4 +104,13 @@ public interface IcCommunitySelfOrganizationService extends BaseService<IcCommun
* @date 2021/11/19 8:33 上午
*/
void addCommunitySelfOrganization(TokenDto tokenDto, AddCommunitySelfOrganizationFormDTO formDTO);
/**
* @Description 修改社区自组织
* @param tokenDto
* @param formDTO
* @author zxc
* @date 2021/11/19 10:12 上午
*/
void editCommunitySelfOrganization(TokenDto tokenDto, EditCommunitySelfOrganizationFormDTO formDTO);
}

11
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcCommunitySelfOrganizationPersonnelServiceImpl.java

@ -97,4 +97,15 @@ public class IcCommunitySelfOrganizationPersonnelServiceImpl extends BaseService
baseDao.deleteBatchIds(Arrays.asList(ids));
}
/**
* @Description 根据社区自组织ID删除
* @param orgId
* @author zxc
* @date 2021/11/19 11:19 上午
*/
@Override
public void deleteByOrgId(String orgId) {
baseDao.deleteByOrgId(orgId);
}
}

49
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcCommunitySelfOrganizationServiceImpl.java

@ -1,9 +1,13 @@
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.entity.BaseEpmetEntity;
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.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.redis.common.CustomerOrgRedis;
@ -12,11 +16,13 @@ import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.commons.tools.validator.PhoneValidatorUtils;
import com.epmet.constant.IcCommunitySelfOrganizationConstant;
import com.epmet.dao.IcCommunitySelfOrganizationDao;
import com.epmet.dto.IcCommunitySelfOrganizationDTO;
import com.epmet.dto.form.AddCommunitySelfOrganizationFormDTO;
import com.epmet.dto.form.EditCommunitySelfOrganizationFormDTO;
import com.epmet.entity.IcCommunitySelfOrganizationEntity;
import com.epmet.entity.IcCommunitySelfOrganizationPersonnelEntity;
import com.epmet.service.IcCommunitySelfOrganizationPersonnelService;
@ -33,6 +39,8 @@ import java.util.Date;
import java.util.List;
import java.util.Map;
import static com.epmet.commons.tools.utils.DateUtils.DATE_PATTERN;
/**
* 社区自组织表
*
@ -107,6 +115,14 @@ public class IcCommunitySelfOrganizationServiceImpl extends BaseServiceImpl<IcCo
@Override
public void addCommunitySelfOrganization(TokenDto tokenDto, AddCommunitySelfOrganizationFormDTO formDTO) {
String customerId = tokenDto.getCustomerId();
LambdaQueryWrapper<IcCommunitySelfOrganizationEntity> l = new LambdaQueryWrapper<>();
l.eq(IcCommunitySelfOrganizationEntity::getOrganizationName,formDTO.getOrganizationName())
.eq(IcCommunitySelfOrganizationEntity::getCustomerId,customerId)
.eq(BaseEpmetEntity::getDelFlag, NumConstant.ZERO);
IcCommunitySelfOrganizationEntity record = baseDao.selectOne(l);
if (null != record){
throw new RenException(EpmetErrorCode.COMMUNITY_SELF_ORGANIZATION_REPART_ERROR.getCode());
}
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(customerId, tokenDto.getUserId());
if (null == staffInfo){
throw new RenException(String.format("查询人员{%s}信息失败",tokenDto.getUserId()));
@ -139,4 +155,37 @@ public class IcCommunitySelfOrganizationServiceImpl extends BaseServiceImpl<IcCo
}
}
/**
* @Description 修改社区自组织
* @param tokenDto
* @param formDTO
* @author zxc
* @date 2021/11/19 10:12 上午
*/
@Override
public void editCommunitySelfOrganization(TokenDto tokenDto, EditCommunitySelfOrganizationFormDTO formDTO) {
LambdaQueryWrapper<IcCommunitySelfOrganizationEntity> l = new LambdaQueryWrapper<>();
l.eq(IcCommunitySelfOrganizationEntity::getOrganizationName,formDTO.getOrganizationName())
.eq(IcCommunitySelfOrganizationEntity::getCustomerId,tokenDto.getCustomerId())
.eq(BaseEpmetEntity::getDelFlag, NumConstant.ZERO)
.ne(BaseEpmetEntity::getId,formDTO.getOrgId());
IcCommunitySelfOrganizationEntity record = baseDao.selectOne(l);
if (null != record){
throw new RenException(EpmetErrorCode.COMMUNITY_SELF_ORGANIZATION_REPART_ERROR.getCode());
}
IcCommunitySelfOrganizationEntity e = ConvertUtils.sourceToTarget(formDTO, IcCommunitySelfOrganizationEntity.class);
e.setOrganizationCreatedTime(DateUtils.stringToDate(formDTO.getOrganizationCreatedTime(),DATE_PATTERN));
e.setUpdatedBy(tokenDto.getUserId());
baseDao.updateCommunitySelfOrganization(e);
personnelService.deleteByOrgId(formDTO.getOrgId());
if (CollectionUtils.isNotEmpty(formDTO.getOrganizationPersonnel())){
List<IcCommunitySelfOrganizationPersonnelEntity> persons = ConvertUtils.sourceToTarget(formDTO.getOrganizationPersonnel(), IcCommunitySelfOrganizationPersonnelEntity.class);
persons.forEach(p -> {
p.setOrgId(formDTO.getOrgId());
p.setCustomerId(tokenDto.getCustomerId());
});
personnelService.insertBatch(persons);
}
}
}

15
epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcCommunitySelfOrganizationDao.xml

@ -3,4 +3,19 @@
<mapper namespace="com.epmet.dao.IcCommunitySelfOrganizationDao">
<update id="updateCommunitySelfOrganization" parameterType="com.epmet.entity.IcCommunitySelfOrganizationEntity">
UPDATE ic_community_self_organization
SET ORGANIZATION_NAME = #{organizationName},
ORGANIZATION_PERSON_COUNT = #{organizationPersonCount},
PRINCIPAL_NAME = #{principalName},
PRINCIPAL_PHONE = #{principalPhone},
SERVICE_ITEM = #{serviceItem},
LONGITUDE = #{longitude},
LATITUDE = #{latitude},
ORGANIZATION_CREATED_TIME = #{organizationCreatedTime},
UPDATED_TIME = NOW(),
UPDATED_BY = #{updatedBy}
WHERE DEL_FLAG = 0
AND ID = #{orgId}
</update>
</mapper>

4
epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcCommunitySelfOrganizationPersonnelDao.xml

@ -3,4 +3,8 @@
<mapper namespace="com.epmet.dao.IcCommunitySelfOrganizationPersonnelDao">
<!-- 根据社区自组织ID删除 -->
<delete id="deleteByOrgId">
DELETE FROM ic_community_self_organization_personnel WHERE ORG_ID = #{orgId}
</delete>
</mapper>
Loading…
Cancel
Save