Browse Source

代码优化

master
sunyuchao 4 years ago
parent
commit
21a6d87dd5
  1. 4
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddPlacePatrolTeamFormDTO.java
  2. 7
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/EditPlacePatrolTeamFormDTO.java
  3. 2
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/GetListPlacePatrolReviewRecordFormDTO.java
  4. 3
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcPlacePatrolTeamController.java
  5. 6
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcPlacePatrolTeamStaffDao.java
  6. 2
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcPlacePatrolTeamService.java
  7. 6
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcPlacePatrolTeamStaffService.java
  8. 21
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcPlacePatrolRecordServiceImpl.java
  9. 4
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcPlacePatrolReviewRecordServiceImpl.java
  10. 11
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcPlacePatrolTeamServiceImpl.java
  11. 13
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcPlacePatrolTeamStaffServiceImpl.java
  12. 6
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcPlaceOrgDao.xml
  13. 10
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcPlacePatrolRecordDao.xml
  14. 6
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcPlacePatrolTeamDao.xml
  15. 11
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcPlacePatrolTeamStaffDao.xml

4
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddPlacePatrolTeamFormDTO.java

@ -106,7 +106,7 @@ public class AddPlacePatrolTeamFormDTO implements Serializable {
* 分队成员信息
*/
@Valid
@NotEmpty(message = "成员列表不能为空")
@NotEmpty(message = "成员列表不能为空", groups = {Add.class})
private List<Member> memberList;
//token中userId
@ -115,7 +115,7 @@ public class AddPlacePatrolTeamFormDTO implements Serializable {
public interface Add { }
@Data
public class Member {
public static class Member {
//姓名
private String name;
//联系电话

7
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/EditPlacePatrolTeamFormDTO.java

@ -35,6 +35,11 @@ import java.util.List;
public class EditPlacePatrolTeamFormDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 客户Id
*/
private String customerId;
/**
* 分队Id
*/
@ -99,7 +104,7 @@ public class EditPlacePatrolTeamFormDTO implements Serializable {
}
@Data
public class Member {
public static class Member {
//姓名
private String name;
//联系电话

2
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/GetListPlacePatrolReviewRecordFormDTO.java

@ -32,9 +32,9 @@ import java.io.Serializable;
public class GetListPlacePatrolReviewRecordFormDTO implements Serializable {
private static final long serialVersionUID = 1L;
//巡查记录Id
@NotBlank(message = "巡查记录Id不能为空", groups = {GetData.class})
private String placePatrolRecordId;
//复查记录Id
@NotBlank(message = "复查记录Id不能为空", groups = {GetData.class})
private String placePatrolReviewRecordId;
//页码
@Min(1)

3
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcPlacePatrolTeamController.java

@ -68,6 +68,7 @@ public class IcPlacePatrolTeamController {
@PostMapping("edit")
public Result edit(@LoginUser TokenDto tokenDto, @RequestBody EditPlacePatrolTeamFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, EditPlacePatrolTeamFormDTO.Edit.class);
formDTO.setCustomerId(tokenDto.getCustomerId());
placePatrolTeamService.edit(formDTO);
return new Result();
}
@ -79,7 +80,7 @@ public class IcPlacePatrolTeamController {
@PostMapping("del")
public Result del(@LoginUser TokenDto tokenDto, @RequestBody EditPlacePatrolTeamFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, EditPlacePatrolTeamFormDTO.Del.class);
placePatrolTeamService.del(formDTO.getTeamId());
placePatrolTeamService.del(tokenDto.getUserId(), formDTO.getTeamId());
return new Result();
}

6
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcPlacePatrolTeamStaffDao.java

@ -51,4 +51,10 @@ public interface IcPlacePatrolTeamStaffDao extends BaseDao<IcPlacePatrolTeamStaf
* @Description 批量查询分队下人员信息
**/
List<IcPlacePatrolTeamStaffDTO> selectByTeamIds(@Param("teamIds") List<String> teamIds);
/**
* @Author sun
* @Description 逻辑删除分队成员子表数据
**/
int upByTeamId(@Param("staffId") String staffId, @Param("teamId") String teamId);
}

2
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcPlacePatrolTeamService.java

@ -49,7 +49,7 @@ public interface IcPlacePatrolTeamService extends BaseService<IcPlacePatrolTeamE
* @Author sun
* @Description 删除九小场所巡查分队人员管理
**/
void del(String teamId);
void del(String staffId, String teamId);
/**
* @Author sun

6
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcPlacePatrolTeamStaffService.java

@ -43,4 +43,10 @@ public interface IcPlacePatrolTeamStaffService extends BaseService<IcPlacePatrol
* @Description 查询分队下人员列表数据
**/
List<IcPlacePatrolTeamStaffDTO> getList(String teamId);
/**
* @Author sun
* @Description 逻辑删除分队成员子表数据
**/
void upByTeamId(String staffId, String teamId);
}

21
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcPlacePatrolRecordServiceImpl.java

@ -112,7 +112,7 @@ public class IcPlacePatrolRecordServiceImpl extends BaseServiceImpl<IcPlacePatro
@Override
public PlacePatrolRecordDetailResultDTO detail(String placePatrolRecordId) {
PlacePatrolRecordDetailResultDTO resultDTO = new PlacePatrolRecordDetailResultDTO();
//1.查询场所基础信息
//1.查询巡查记录信息
GetListPlacePatrolRecordFormDTO dto = new GetListPlacePatrolRecordFormDTO();
dto.setPlacePatrolRecordId(placePatrolRecordId);
List<PlacePatrolRecordDetailResultDTO> result = baseDao.getList(dto);
@ -127,12 +127,27 @@ public class IcPlacePatrolRecordServiceImpl extends BaseServiceImpl<IcPlacePatro
throw new RenException("获取九小场所基本信息失败......");
}
//3.封装九小场所数据
//3.查询所有分队下人员名单
List<String> teamIds = new ArrayList<>();
teamIds.add(resultDTO.getPlacePatrolTeamId());
List<IcPlacePatrolTeamStaffDTO> teamDTOList = icPlacePatrolTeamStaffDao.selectByTeamIds(teamIds);
//4.封装九小场所、分队成员数据
for (OptionResultDTO n : nineList.getData()){
if(resultDTO.getNinePlaceVal().equals(n.getValue())){
resultDTO.setNinePlaceName(n.getLabel());
}
}
//分队成员
StringBuffer inspectorsNames = new StringBuffer("");
for (String str : resultDTO.getInspectors().split(",")) {
teamDTOList.forEach(r -> {
if (str.equals(r.getId())) {
inspectorsNames.append("".equals(inspectorsNames.toString().trim()) ? r.getName() : "," + r.getName());
}
});
}
resultDTO.setInspectorsNames(inspectorsNames.toString());
return resultDTO;
}
@ -175,7 +190,7 @@ public class IcPlacePatrolRecordServiceImpl extends BaseServiceImpl<IcPlacePatro
for (String str : dto.getInspectors().split(",")) {
teamDTOList.forEach(r -> {
if (str.equals(r.getId())) {
inspectorsNames.append("".equals(inspectorsNames) ? r.getName() : "," + r.getName());
inspectorsNames.append("".equals(inspectorsNames.toString().trim()) ? r.getName() : "," + r.getName());
}
});
}

4
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcPlacePatrolReviewRecordServiceImpl.java

@ -153,7 +153,7 @@ public class IcPlacePatrolReviewRecordServiceImpl extends BaseServiceImpl<IcPlac
for (String str : resultDTO.getInspectors().split(",")) {
teamDTOList.forEach(r -> {
if (str.equals(r.getId())) {
inspectorsNames.append("".equals(inspectorsNames) ? r.getName() : "," + r.getName());
inspectorsNames.append("".equals(inspectorsNames.toString().trim()) ? r.getName() : "," + r.getName());
}
});
}
@ -189,7 +189,7 @@ public class IcPlacePatrolReviewRecordServiceImpl extends BaseServiceImpl<IcPlac
for (String str : dto.getInspectors().split(",")) {
teamDTOList.forEach(r -> {
if (str.equals(r.getId())) {
inspectorsNames.append("".equals(inspectorsNames) ? r.getName() : "," + r.getName());
inspectorsNames.append("".equals(inspectorsNames.toString().trim()) ? r.getName() : "," + r.getName());
}
});
}

11
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcPlacePatrolTeamServiceImpl.java

@ -119,6 +119,7 @@ public class IcPlacePatrolTeamServiceImpl extends BaseServiceImpl<IcPlacePatrolT
entity1.setMobile(m.getMobile());
entityList.add(entity1);
}
//物理删除
placePatrolTeamStaffService.delByTeamId(formDTO.getTeamId());
placePatrolTeamStaffService.insertBatch(entityList);
@ -130,13 +131,13 @@ public class IcPlacePatrolTeamServiceImpl extends BaseServiceImpl<IcPlacePatrolT
**/
@Override
@Transactional(rollbackFor = Exception.class)
public void del(String teamId) {
public void del(String staffId, String teamId) {
//1.删除分队主表数据
if (baseDao.deleteById(teamId) < NumConstant.ONE) {
throw new RenException(String.format("删除九小场所下分队信息失败,分队Id->%s", teamId));
}
//2.删除分队成员字表数据
placePatrolTeamStaffService.delByTeamId(teamId);
//2.逻辑删除分队成员字表数据
placePatrolTeamStaffService.upByTeamId(staffId, teamId);
}
/**
@ -174,7 +175,7 @@ public class IcPlacePatrolTeamServiceImpl extends BaseServiceImpl<IcPlacePatrolT
StringBuffer gridNames = new StringBuffer("");
for (String str : resultDTO.getGridIds().split(",")) {
gridList.forEach(r -> {
if (str.equals(r.getGridName())) {
if (str.equals(r.getId())) {
gridNames.append("".equals(gridNames) ? r.getGridName() : "," + r.getGridName());
}
});
@ -230,7 +231,7 @@ public class IcPlacePatrolTeamServiceImpl extends BaseServiceImpl<IcPlacePatrolT
StringBuffer gridNames = new StringBuffer("");
for (String str : dto.getGridIds().split(",")) {
gridList.forEach(r -> {
if (str.equals(r.getGridName())) {
if (str.equals(r.getId())) {
gridNames.append("".equals(gridNames) ? r.getGridName() : "," + r.getGridName());
}
});

13
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcPlacePatrolTeamStaffServiceImpl.java

@ -48,9 +48,22 @@ public class IcPlacePatrolTeamStaffServiceImpl extends BaseServiceImpl<IcPlacePa
return baseDao.delByTeamId(teamId);
}
/**
* @Author sun
* @Description 查询分队下人员列表数据
**/
@Override
public List<IcPlacePatrolTeamStaffDTO> getList(String teamId) {
return baseDao.getByTeamId(teamId);
}
/**
* @Author sun
* @Description 逻辑删除分队成员子表数据
**/
@Override
public void upByTeamId(String staffId, String teamId) {
baseDao.upByTeamId(staffId, teamId);
}
}

6
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcPlaceOrgDao.xml

@ -8,7 +8,7 @@
a.id placeOrgId,
a.grid_id gridId,
b.grid_name gridName,
a.nine_place_val ninePlaceVale,
a.nine_place_val ninePlaceVal,
a.place_org_name placeOrgName,
a.address address,
a.scale scale,
@ -28,8 +28,8 @@
<if test="gridId != null and gridId.trim() != ''">
AND a.grid_id = #{gridId}
</if>
<if test="ninePlacsVal != null and ninePlacsVal.trim() != ''">
AND a.nine_place_val = #{ninePlacsVal}
<if test="ninePlaceVal != null and ninePlaceVal.trim() != ''">
AND a.nine_place_val = #{ninePlaceVal}
</if>
<if test="placeOrgName != null and placeOrgName.trim() != ''">
AND a.place_org_name LIKE CONCAT('%', #{placeOrgName}, '%')

10
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcPlacePatrolRecordDao.xml

@ -13,7 +13,7 @@
c.place_org_name placeOrgName,
a.place_patrol_team_id placePatrolTeamId,
d.team_name placePatrolTeamName,
a.nine_placs_val ninePlaceVal,
a.nine_place_val ninePlaceVal,
a.inspectors inspectors,
a.first_time firstTime,
a.first_result firstResult,
@ -28,15 +28,17 @@
LEFT JOIN ic_place_patrol_team d ON a.place_patrol_team_id = d.id
WHERE
a.del_flag = '0'
AND a.customer_id = ''
<if test="placePatrolRecordId != null and placePatrolRecordId.trim() != ''">
AND a.id = #{placePatrolRecordId}
</if>
<if test="customerId != null and customerId.trim() != ''">
AND a.customer_id = #{customerId}
</if>
<if test="gridId != null and gridId.trim() != ''">
AND a.grid_id = #{gridId}
</if>
<if test="ninePlacsVal != null and ninePlacsVal.trim() != ''">
AND a.nine_place_val = #{ninePlacsVal}
<if test="ninePlaceVal != null and ninePlaceVal.trim() != ''">
AND a.nine_place_val = #{ninePlaceVal}
</if>
<if test="placeOrgName != null and placeOrgName.trim() != ''">
AND a.place_org_id IN (select id from ic_place_org where place_org_name like concat('%', #{placeOrgName}, '%'))

6
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcPlacePatrolTeamDao.xml

@ -6,7 +6,7 @@
<resultMap id="teamList" type="com.epmet.dto.result.PlacePatrolTeamDetailResultDTO">
<result property="teamId" column="id"/>
<result property="gridIds" column="grid_ids"/>
<result property="ninePlaceVals" column="nine_placs_vals"/>
<result property="ninePlaceVals" column="nine_place_vals"/>
<result property="teamName" column="team_name"/>
<result property="plan" column="plan"/>
<result property="time" column="time"/>
@ -30,8 +30,8 @@
<if test="gridId != null and gridId.trim() != ''">
AND grid_ids LIKE CONCAT('%', #{gridId}, '%')
</if>
<if test="ninePlacsVal != null and ninePlacsVal.trim() != ''">
AND nine_placs_vals LIKE CONCAT('%', #{ninePlacsVal}, '%')
<if test="ninePlaceVal != null and ninePlaceVal.trim() != ''">
AND nine_place_vals LIKE CONCAT('%', #{ninePlaceVal}, '%')
</if>
<if test="personInCharge != null and personInCharge.trim() != ''">
AND person_in_charge LIKE CONCAT('%', #{personInCharge}, '%')

11
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcPlacePatrolTeamStaffDao.xml

@ -36,4 +36,15 @@
place_patrol_team_id ASC
</select>
<update id="upByTeamId">
UPDATE
ic_place_patrol_team_staff
SET
del_flag = '1',
updated_by = #{staffId},
updated_time = NOW()
WHERE
place_patrol_team_id = #{teamId}
</update>
</mapper>
Loading…
Cancel
Save