Browse Source

查询

dev_shibei_match
zxc 4 years ago
parent
commit
4bc3e61cd7
  1. 49
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/CommunitySelfOrganizationListFormDTO.java
  2. 89
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/CommunitySelfOrganizationListDTO.java
  3. 28
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/CommunitySelfOrganizationListResultDTO.java
  4. 15
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcCommunitySelfOrganizationController.java
  5. 19
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcCommunitySelfOrganizationDao.java
  6. 11
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcCommunitySelfOrganizationService.java
  7. 34
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcCommunitySelfOrganizationServiceImpl.java
  8. 50
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcCommunitySelfOrganizationDao.xml

49
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/CommunitySelfOrganizationListFormDTO.java

@ -0,0 +1,49 @@
package com.epmet.dto.form;
import lombok.Data;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
* @Author zxc
* @DateTime 2021/11/19 1:47 下午
* @DESC
*/
@Data
public class CommunitySelfOrganizationListFormDTO implements Serializable {
private static final long serialVersionUID = 4202083250504143469L;
public interface CommunitySelfOrganizationListForm{}
/**
* 社区自组织名
*/
private String organizationName;
/**
* 开始时间
*/
private String startTime;
/**
* 结束时间
*/
private String endTime;
@NotNull(message = "pageNo不能为空",groups = CommunitySelfOrganizationListForm.class)
private Integer pageNo;
@NotNull(message = "pageSize不能为空",groups = CommunitySelfOrganizationListForm.class)
private Integer pageSize;
/**
* 是否分页默认true分页
*/
private Boolean isPage = true;
private String customerId;
private String agencyId;
private Integer ranking;
}

89
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/CommunitySelfOrganizationListDTO.java

@ -0,0 +1,89 @@
package com.epmet.dto.result;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.dto.IcCommunitySelfOrganizationPersonnelDTO;
import lombok.Data;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
/**
* @Author zxc
* @DateTime 2021/11/19 1:47 下午
* @DESC
*/
@Data
public class CommunitySelfOrganizationListDTO implements Serializable {
private static final long serialVersionUID = 3208034033470533749L;
/**
* 排序
*/
private Integer sort;
/**
* 社区自组织人数
*/
private Integer organizationPersonCount;
/**
* 社区自组织名字
*/
private String organizationName;
/**
* 服务事项
*/
private String serviceItem;
/**
* 负责人
*/
private String principalName;
/**
* 负责人电话
*/
private String principalPhone;
/**
* 自组织创办时间
*/
private String organizationCreatedTime;
/**
* 经度
*/
private String longitude;
/**
* 纬度
*/
private String latitude;
/**
* 社区自组织ID
*/
private String orgId;
/**
* 社区自组织人员
*/
private List<IcCommunitySelfOrganizationPersonnelDTO> organizationPersonnel;
public CommunitySelfOrganizationListDTO() {
this.sort = NumConstant.ZERO;
this.organizationPersonCount = NumConstant.ZERO;
this.organizationName = "";
this.serviceItem = "";
this.principalName = "";
this.principalPhone = "";
this.organizationCreatedTime = "";
this.longitude = "";
this.latitude = "";
this.orgId = "";
this.organizationPersonnel = new ArrayList<>();
}
}

28
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/CommunitySelfOrganizationListResultDTO.java

@ -0,0 +1,28 @@
package com.epmet.dto.result;
import com.epmet.commons.tools.constant.NumConstant;
import lombok.Data;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
/**
* @Author zxc
* @DateTime 2021/11/19 1:47 下午
* @DESC
*/
@Data
public class CommunitySelfOrganizationListResultDTO implements Serializable {
private static final long serialVersionUID = 3208034033470533749L;
private Integer total;
private List<CommunitySelfOrganizationListDTO> list;
public CommunitySelfOrganizationListResultDTO() {
this.total = NumConstant.ZERO;
this.list = new ArrayList<>();
}
}

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

@ -30,7 +30,9 @@ 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.CommunitySelfOrganizationListFormDTO;
import com.epmet.dto.form.EditCommunitySelfOrganizationFormDTO;
import com.epmet.dto.result.CommunitySelfOrganizationListResultDTO;
import com.epmet.excel.IcCommunitySelfOrganizationExcel;
import com.epmet.service.IcCommunitySelfOrganizationService;
import org.springframework.beans.factory.annotation.Autowired;
@ -124,4 +126,17 @@ public class IcCommunitySelfOrganizationController {
return new Result();
}
/**
* @Description 查询社区自组织列表
* @param tokenDto
* @param formDTO
* @author zxc
* @date 2021/11/19 1:59 下午
*/
@PostMapping("communityselforganizationlist")
public Result<CommunitySelfOrganizationListResultDTO> communitySelfOrganizationList(@LoginUser TokenDto tokenDto,@RequestBody CommunitySelfOrganizationListFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO, CommunitySelfOrganizationListFormDTO.CommunitySelfOrganizationListForm.class);
return new Result<CommunitySelfOrganizationListResultDTO>().ok(icCommunitySelfOrganizationService.communitySelfOrganizationList(tokenDto, formDTO));
}
}

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

@ -18,9 +18,14 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.form.CommunitySelfOrganizationListFormDTO;
import com.epmet.dto.form.EditCommunitySelfOrganizationFormDTO;
import com.epmet.dto.result.CommunitySelfOrganizationListDTO;
import com.epmet.entity.IcCommunitySelfOrganizationEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 社区自组织表
@ -31,6 +36,20 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface IcCommunitySelfOrganizationDao extends BaseDao<IcCommunitySelfOrganizationEntity> {
/**
* @Description 自组织修改
* @param formDTO
* @author zxc
* @date 2021/11/19 2:04 下午
*/
void updateCommunitySelfOrganization(IcCommunitySelfOrganizationEntity formDTO);
/**
* @Description 查询社区自组织列表
* @param formDTO
* @author zxc
* @date 2021/11/19 2:05 下午
*/
List<CommunitySelfOrganizationListDTO> selectCommunitySelfOrganizationList(CommunitySelfOrganizationListFormDTO formDTO);
}

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

@ -22,7 +22,9 @@ 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.CommunitySelfOrganizationListFormDTO;
import com.epmet.dto.form.EditCommunitySelfOrganizationFormDTO;
import com.epmet.dto.result.CommunitySelfOrganizationListResultDTO;
import com.epmet.entity.IcCommunitySelfOrganizationEntity;
import java.util.List;
@ -113,4 +115,13 @@ public interface IcCommunitySelfOrganizationService extends BaseService<IcCommun
* @date 2021/11/19 10:12 上午
*/
void editCommunitySelfOrganization(TokenDto tokenDto, EditCommunitySelfOrganizationFormDTO formDTO);
/**
* @Description 查询社区自组织列表
* @param tokenDto
* @param formDTO
* @author zxc
* @date 2021/11/19 1:59 下午
*/
CommunitySelfOrganizationListResultDTO communitySelfOrganizationList(TokenDto tokenDto, CommunitySelfOrganizationListFormDTO formDTO);
}

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

@ -22,11 +22,16 @@ 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.CommunitySelfOrganizationListFormDTO;
import com.epmet.dto.form.EditCommunitySelfOrganizationFormDTO;
import com.epmet.dto.result.CommunitySelfOrganizationListDTO;
import com.epmet.dto.result.CommunitySelfOrganizationListResultDTO;
import com.epmet.entity.IcCommunitySelfOrganizationEntity;
import com.epmet.entity.IcCommunitySelfOrganizationPersonnelEntity;
import com.epmet.service.IcCommunitySelfOrganizationPersonnelService;
import com.epmet.service.IcCommunitySelfOrganizationService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
@ -188,4 +193,33 @@ public class IcCommunitySelfOrganizationServiceImpl extends BaseServiceImpl<IcCo
}
}
/**
* @Description 查询社区自组织列表
* @param tokenDto
* @param formDTO
* @author zxc
* @date 2021/11/19 1:59 下午
*/
@Override
public CommunitySelfOrganizationListResultDTO communitySelfOrganizationList(TokenDto tokenDto, CommunitySelfOrganizationListFormDTO formDTO) {
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(tokenDto.getCustomerId(), tokenDto.getUserId());
if (null == staffInfo){
throw new RenException(String.format("查询人员{%s}信息失败",tokenDto.getUserId()));
}
formDTO.setAgencyId(staffInfo.getAgencyId());
formDTO.setCustomerId(tokenDto.getCustomerId());
final int[] i = {(formDTO.getPageNo() - NumConstant.ONE) * formDTO.getPageSize() + NumConstant.ONE};
CommunitySelfOrganizationListResultDTO result = new CommunitySelfOrganizationListResultDTO();
PageInfo<CommunitySelfOrganizationListDTO> objectPageInfo = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize(), formDTO.getIsPage()).doSelectPageInfo(() -> baseDao.selectCommunitySelfOrganizationList(formDTO));
result.setTotal(Integer.valueOf(String.valueOf(objectPageInfo.getTotal())));
if (CollectionUtils.isNotEmpty(objectPageInfo.getList())){
objectPageInfo.getList().forEach(l -> {
l.setSort(i[NumConstant.ZERO]);
i[NumConstant.ZERO]++;
});
result.setList(objectPageInfo.getList());
}
return result;
}
}

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

@ -3,6 +3,7 @@
<mapper namespace="com.epmet.dao.IcCommunitySelfOrganizationDao">
<!-- 自组织修改 -->
<update id="updateCommunitySelfOrganization" parameterType="com.epmet.entity.IcCommunitySelfOrganizationEntity">
UPDATE ic_community_self_organization
SET ORGANIZATION_NAME = #{organizationName},
@ -18,4 +19,53 @@
WHERE DEL_FLAG = 0
AND ID = #{orgId}
</update>
<!-- 查询社区自组织列表 -->
<resultMap id="selectCommunitySelfOrganizationListMap" type="com.epmet.dto.result.CommunitySelfOrganizationListDTO">
<result property="organizationName" column="organizationName"/>
<result property="organizationPersonCount" column="organizationPersonCount"/>
<result property="organizationCreatedTime" column="organizationCreatedTime"/>
<result property="principalName" column="principalName"/>
<result property="principalPhone" column="principalPhone"/>
<result property="serviceItem" column="serviceItem"/>
<result property="longitude" column="longitude"/>
<result property="latitude" column="latitude"/>
<collection property="organizationPersonnel" ofType="com.epmet.dto.IcCommunitySelfOrganizationPersonnelDTO"
column="orgId" select="selectPerson"></collection>
</resultMap>
<select id="selectPerson" resultType="com.epmet.dto.IcCommunitySelfOrganizationPersonnelDTO">
select
person_name AS personName,
person_phone as personPhone
from ic_community_self_organization_personnel
where org_id = #{orgId}
and del_flag = 0
</select>
<select id="selectCommunitySelfOrganizationList" resultMap="selectCommunitySelfOrganizationListMap" parameterType="com.epmet.dto.form.CommunitySelfOrganizationListFormDTO">
SELECT
so.ORGANIZATION_NAME AS organizationName,
so.ORGANIZATION_PERSON_COUNT AS organizationPersonCount,
DATE_FORMAT(so.ORGANIZATION_CREATED_TIME,'%Y-%m-%d') AS organizationCreatedTime,
so.PRINCIPAL_NAME AS principalName,
so.PRINCIPAL_PHONE AS principalPhone,
so.SERVICE_ITEM AS serviceItem,
so.LONGITUDE AS longitude,
so.LATITUDE AS latitude,
so.ID as orgId
FROM ic_community_self_organization so
# LEFT JOIN ic_community_self_organization_personnel op ON (op.ORG_ID = so.ID AND op.DEL_FLAG = 0)
WHERE so.DEL_FLAG = 0
AND so.ORG_ID = #{agencyId}
AND so.CUSTOMER_ID = #{customerId}
<if test="null != organizationName and organizationName != '' ">
AND so.ORGANIZATION_NAME LIKE CONCAT('%',#{organizationName},'%')
</if>
<if test=" null != startTime and startTime != '' ">
AND DATE_FORMAT(so.ORGANIZATION_CREATED_TIME,'%Y%m%d') <![CDATA[ >= ]]> #{startTime}
</if>
<if test="null != endTime and endTime != '' ">
AND DATE_FORMAT(so.ORGANIZATION_CREATED_TIME,'%Y%m%d') <![CDATA[ <= ]]> #{endTime}
</if>
ORDER BY so.ORGANIZATION_CREATED_TIME DESC
</select>
</mapper>
Loading…
Cancel
Save