Browse Source

Merge remote-tracking branch 'remotes/origin/develop' into release_temp

dev_shibei_match
jianjun 4 years ago
parent
commit
f520c1b780
  1. 3
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/IpUtils.java
  2. 18
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcPartyActivityServiceImpl.java
  3. 10
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcPlacePatrolReviewRecordController.java
  4. 4
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcPlacePatrolReviewRecordService.java
  5. 14
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcPlacePatrolReviewRecordServiceImpl.java
  6. 6
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcPlacePatrolRecordDao.xml
  7. 2
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcPlacePatrolReviewRecordDao.xml

3
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/IpUtils.java

@ -62,6 +62,8 @@ public class IpUtils {
if (StringUtils.isEmpty(ip) || IP_UNKNOWN.equalsIgnoreCase(ip)) {
ip = request.getRemoteAddr();
}
logger.info("getIpAddr origin ip:{}",ip);
//对于通过多个代理的情况,第一个IP为客户端真实IP,多个IP按照','分割
if (ip != null) { //"***.***.***.***".length() = 15
if (ip.indexOf(StrConstant.COMMA) > 0) {
@ -72,7 +74,6 @@ public class IpUtils {
} catch (Exception e) {
logger.error("IpUtils getIpAddr ERROR ", e);
}
return ip;
}

18
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcPartyActivityServiceImpl.java

@ -26,6 +26,7 @@ import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.redis.common.CustomerStaffRedis;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.dao.IcPartyActivityDao;
import com.epmet.dto.IcPartyActivityDTO;
import com.epmet.dto.IcPartyUnitDTO;
@ -42,6 +43,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@ -60,6 +62,14 @@ public class IcPartyActivityServiceImpl extends BaseServiceImpl<IcPartyActivityD
@Override
public PageData<IcPartyActivityDTO> search(PartyActivityFormDTO formDTO) {
if (null == formDTO.getStartTime()) {
Date startDate = DateUtils.parse("1900-01-01 00:00:00", DateUtils.DATE_TIME_PATTERN);
formDTO.setStartTime(startDate);
}
if (null == formDTO.getEndTime()) {
Date endDate = DateUtils.parse("2099-12-31 00:00:00", DateUtils.DATE_TIME_PATTERN);
formDTO.setEndTime(endDate);
}
PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize());
LambdaQueryWrapper<IcPartyActivityEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(IcPartyActivityEntity::getAgencyId, formDTO.getAgencyId());
@ -85,6 +95,14 @@ public class IcPartyActivityServiceImpl extends BaseServiceImpl<IcPartyActivityD
@Override
public List<IcPartyActivityDTO> list(PartyActivityFormDTO formDTO) {
if (null == formDTO.getStartTime()) {
Date startDate = DateUtils.parse("1900-01-01 00:00:00", DateUtils.DATE_TIME_PATTERN);
formDTO.setStartTime(startDate);
}
if (null == formDTO.getEndTime()) {
Date endDate = DateUtils.parse("2099-12-31 00:00:00", DateUtils.DATE_TIME_PATTERN);
formDTO.setEndTime(endDate);
}
LambdaQueryWrapper<IcPartyActivityEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(IcPartyActivityEntity::getAgencyId, formDTO.getAgencyId());
wrapper.eq(StringUtils.isNotBlank(formDTO.getUnitId()), IcPartyActivityEntity::getUnitId, formDTO.getUnitId());

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;
}
/**

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

@ -43,6 +43,12 @@
<if test="ninePlaceVal != null and ninePlaceVal.trim() != ''">
AND a.nine_place_val = #{ninePlaceVal}
</if>
<if test="firstResult != null and firstResult.trim() != ''">
AND a.first_result = #{firstResult}
</if>
<if test="finalResult != null and finalResult.trim() != ''">
AND a.final_result = #{finalResult}
</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}, '%'))
</if>

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