|
|
@ -2,20 +2,26 @@ 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.service.impl.BaseServiceImpl; |
|
|
|
import com.epmet.commons.tools.constant.FieldConstant; |
|
|
|
import com.epmet.commons.tools.constant.StrConstant; |
|
|
|
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; |
|
|
|
import com.epmet.commons.tools.page.PageData; |
|
|
|
import com.epmet.commons.tools.redis.common.CustomerOrgRedis; |
|
|
|
import com.epmet.commons.tools.redis.common.CustomerStaffRedis; |
|
|
|
import com.epmet.commons.tools.redis.common.bean.GridInfoCache; |
|
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
|
import com.epmet.dao.DataSyncRecordDeathDao; |
|
|
|
import com.epmet.dto.DataSyncRecordDeathDTO; |
|
|
|
import com.epmet.dto.form.dataSync.DataSyncRecordDeathPageFormDTO; |
|
|
|
import com.epmet.entity.DataSyncRecordDeathEntity; |
|
|
|
import com.epmet.service.DataSyncRecordDeathService; |
|
|
|
import com.github.pagehelper.PageHelper; |
|
|
|
import com.github.pagehelper.PageInfo; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
import java.util.Arrays; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
|
|
|
@ -28,13 +34,19 @@ import java.util.Map; |
|
|
|
@Service |
|
|
|
public class DataSyncRecordDeathServiceImpl extends BaseServiceImpl<DataSyncRecordDeathDao, DataSyncRecordDeathEntity> implements DataSyncRecordDeathService { |
|
|
|
|
|
|
|
/** |
|
|
|
* 列表查询 |
|
|
|
* @param formDTO |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public PageData<DataSyncRecordDeathDTO> page(Map<String, Object> params) { |
|
|
|
IPage<DataSyncRecordDeathEntity> page = baseDao.selectPage( |
|
|
|
getPage(params, FieldConstant.CREATED_TIME, false), |
|
|
|
getWrapper(params) |
|
|
|
); |
|
|
|
return getPageData(page, DataSyncRecordDeathDTO.class); |
|
|
|
public PageData<DataSyncRecordDeathDTO> page(DataSyncRecordDeathPageFormDTO formDTO) { |
|
|
|
CustomerStaffInfoCacheResult staffInfoCacheResult = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getStaffId()); |
|
|
|
formDTO.setAgencyId(null != staffInfoCacheResult ? staffInfoCacheResult.getAgencyId() : null); |
|
|
|
PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()); |
|
|
|
List<DataSyncRecordDeathDTO> records = baseDao.pageSelect(formDTO.getCustomerId(),formDTO.getIdCard(), formDTO.getName(), formDTO.getAgencyId()); |
|
|
|
PageInfo<DataSyncRecordDeathDTO> pi = new PageInfo<>(records); |
|
|
|
return new PageData<>(records, pi.getTotal()); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
@ -53,31 +65,32 @@ public class DataSyncRecordDeathServiceImpl extends BaseServiceImpl<DataSyncReco |
|
|
|
return wrapper; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 返回详情:带网格名称 |
|
|
|
* |
|
|
|
* @param id |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public DataSyncRecordDeathDTO get(String id) { |
|
|
|
DataSyncRecordDeathEntity entity = baseDao.selectById(id); |
|
|
|
return ConvertUtils.sourceToTarget(entity, DataSyncRecordDeathDTO.class); |
|
|
|
DataSyncRecordDeathDTO recordDeathDTO = ConvertUtils.sourceToTarget(entity, DataSyncRecordDeathDTO.class); |
|
|
|
if (StringUtils.isNotBlank(recordDeathDTO.getGridId())) { |
|
|
|
GridInfoCache gridInfoCache = CustomerOrgRedis.getGridInfo(entity.getGridId()); |
|
|
|
recordDeathDTO.setGridName(null != gridInfoCache ? gridInfoCache.getGridNamePath() : StrConstant.EPMETY_STR); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void save(DataSyncRecordDeathDTO dto) { |
|
|
|
DataSyncRecordDeathEntity entity = ConvertUtils.sourceToTarget(dto, DataSyncRecordDeathEntity.class); |
|
|
|
insert(entity); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void update(DataSyncRecordDeathDTO dto) { |
|
|
|
DataSyncRecordDeathEntity entity = ConvertUtils.sourceToTarget(dto, DataSyncRecordDeathEntity.class); |
|
|
|
updateById(entity); |
|
|
|
return recordDeathDTO; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 批量删除 |
|
|
|
* @param ids |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void delete(String[] ids) { |
|
|
|
public void delete(List<String> ids) { |
|
|
|
// 逻辑删除(@TableLogic 注解)
|
|
|
|
baseDao.deleteBatchIds(Arrays.asList(ids)); |
|
|
|
baseDao.deleteBatchIds(ids); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|