Browse Source

Merge branch 'dev_ic_v2' into develop

master
sunyuchao 4 years ago
parent
commit
581559ad06
  1. 10
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcPlacePatrolReviewRecordController.java
  2. 4
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcPlacePatrolReviewRecordService.java
  3. 14
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcPlacePatrolReviewRecordServiceImpl.java
  4. 2
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcPlacePatrolReviewRecordDao.xml

10
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcPlacePatrolReviewRecordController.java

@ -52,11 +52,10 @@ public class IcPlacePatrolReviewRecordController {
* @Description 新增巡查复查记录
**/
@PostMapping("add")
public Result add(@LoginUser TokenDto tokenDto, @RequestBody AddPlacePatrolReviewRecordFormDTO formDTO) {
public Result<PlacePatrolReviewRecordDetailResultDTO> add(@LoginUser TokenDto tokenDto, @RequestBody AddPlacePatrolReviewRecordFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, AddPlacePatrolReviewRecordFormDTO.Add.class);
formDTO.setCustomerId(tokenDto.getCustomerId());
placePatrolReviewRecordService.add(formDTO);
return new Result();
return new Result<PlacePatrolReviewRecordDetailResultDTO>().ok(placePatrolReviewRecordService.add(formDTO));
}
/**
@ -64,10 +63,9 @@ public class IcPlacePatrolReviewRecordController {
* @Description 修改巡查复查记录
**/
@PostMapping("edit")
public Result edit(@LoginUser TokenDto tokenDto, @RequestBody EditPlacePatrolReviewRecordFormDTO formDTO) {
public Result<PlacePatrolReviewRecordDetailResultDTO> edit(@LoginUser TokenDto tokenDto, @RequestBody EditPlacePatrolReviewRecordFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, EditPlacePatrolReviewRecordFormDTO.Edit.class);
placePatrolReviewRecordService.edit(formDTO);
return new Result();
return new Result<PlacePatrolReviewRecordDetailResultDTO>().ok(placePatrolReviewRecordService.edit(formDTO));
}
/**

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

@ -37,13 +37,13 @@ public interface IcPlacePatrolReviewRecordService extends BaseService<IcPlacePat
* @Author sun
* @Description 新增巡查复查记录
**/
void add(AddPlacePatrolReviewRecordFormDTO formDTO);
PlacePatrolReviewRecordDetailResultDTO add(AddPlacePatrolReviewRecordFormDTO formDTO);
/**
* @Author sun
* @Description 修改巡查复查记录
**/
void edit(EditPlacePatrolReviewRecordFormDTO formDTO);
PlacePatrolReviewRecordDetailResultDTO edit(EditPlacePatrolReviewRecordFormDTO formDTO);
/**
* @Author sun

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

@ -75,10 +75,12 @@ public class IcPlacePatrolReviewRecordServiceImpl extends BaseServiceImpl<IcPlac
**/
@Override
@Transactional(rollbackFor = Exception.class)
public void add(AddPlacePatrolReviewRecordFormDTO formDTO) {
public PlacePatrolReviewRecordDetailResultDTO add(AddPlacePatrolReviewRecordFormDTO formDTO) {
PlacePatrolReviewRecordDetailResultDTO resultDTO = new PlacePatrolReviewRecordDetailResultDTO();
//1.复查记录表新增数据
IcPlacePatrolReviewRecordEntity entity = ConvertUtils.sourceToTarget(formDTO, IcPlacePatrolReviewRecordEntity.class);
insert(entity);
//2.修改巡查记录数据最新巡查时间和结果
IcPlacePatrolRecordEntity recordEntity = new IcPlacePatrolRecordEntity();
recordEntity.setId(entity.getPlacePatrolRecordId());
@ -86,6 +88,9 @@ public class IcPlacePatrolReviewRecordServiceImpl extends BaseServiceImpl<IcPlac
recordEntity.setFinalTime(entity.getReviewTime());
icPlacePatrolRecordService.updateById(recordEntity);
//3.返回详情数据
resultDTO = detail(entity.getId());
return resultDTO;
}
/**
@ -94,7 +99,8 @@ public class IcPlacePatrolReviewRecordServiceImpl extends BaseServiceImpl<IcPlac
**/
@Override
@Transactional(rollbackFor = Exception.class)
public void edit(EditPlacePatrolReviewRecordFormDTO formDTO) {
public PlacePatrolReviewRecordDetailResultDTO edit(EditPlacePatrolReviewRecordFormDTO formDTO) {
PlacePatrolReviewRecordDetailResultDTO resultDTO = new PlacePatrolReviewRecordDetailResultDTO();
//1.修改复查记录表数据
IcPlacePatrolReviewRecordEntity entity = baseDao.selectById(formDTO.getPlacePatrolReviewRecordId());
if (null == entity) {
@ -103,6 +109,7 @@ public class IcPlacePatrolReviewRecordServiceImpl extends BaseServiceImpl<IcPlac
entity = ConvertUtils.sourceToTarget(formDTO, IcPlacePatrolReviewRecordEntity.class);
entity.setId(formDTO.getPlacePatrolReviewRecordId());
baseDao.updateById(entity);
//2.复查记录修改了复查时间或复查结果时对应修改巡查记录数据最新巡查时间和结果
if (StringUtils.isNotEmpty(formDTO.getReviewResult()) || StringUtils.isNotEmpty(formDTO.getReviewTime().toString())) {
IcPlacePatrolRecordEntity recordEntity = new IcPlacePatrolRecordEntity();
@ -116,6 +123,9 @@ public class IcPlacePatrolReviewRecordServiceImpl extends BaseServiceImpl<IcPlac
icPlacePatrolRecordService.updateById(recordEntity);
}
//3.返回复查记录修改后的详情数据
resultDTO = detail(formDTO.getPlacePatrolReviewRecordId());
return resultDTO;
}
/**

2
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcPlacePatrolReviewRecordDao.xml

@ -39,7 +39,7 @@
AND a.id = #{placePatrolReviewRecordId}
</if>
ORDER BY
a.created_time DESC
a.created_time ASC
</select>
</mapper>
Loading…
Cancel
Save