|
|
@ -12,6 +12,7 @@ import com.epmet.commons.tools.page.PageData; |
|
|
|
import com.epmet.commons.tools.security.user.LoginUserUtil; |
|
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
|
import com.epmet.dao.CustomerAgencyDao; |
|
|
|
import com.epmet.dao.CustomerGridDao; |
|
|
|
import com.epmet.dao.IcWorkLogDao; |
|
|
|
import com.epmet.dto.CustomerStaffDTO; |
|
|
@ -19,6 +20,8 @@ import com.epmet.dto.IcWorkLogDTO; |
|
|
|
import com.epmet.dto.IcWorkLogFileDTO; |
|
|
|
import com.epmet.dto.form.CustomerGridFormDTO; |
|
|
|
import com.epmet.dto.result.GridDetailResultDTO; |
|
|
|
import com.epmet.entity.CustomerAgencyEntity; |
|
|
|
import com.epmet.entity.CustomerGridEntity; |
|
|
|
import com.epmet.entity.IcWorkLogEntity; |
|
|
|
import com.epmet.entity.IcWorkLogFileEntity; |
|
|
|
import com.epmet.feign.EpmetAdminOpenFeignClient; |
|
|
@ -64,6 +67,9 @@ public class IcWorkLogServiceImpl extends BaseServiceImpl<IcWorkLogDao, IcWorkLo |
|
|
|
@Resource |
|
|
|
private CustomerGridDao customerGridDao; |
|
|
|
|
|
|
|
@Resource |
|
|
|
private CustomerAgencyDao customerAgencyDao; |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public PageData<IcWorkLogDTO> page(Map<String, Object> params) { |
|
|
@ -110,6 +116,11 @@ public class IcWorkLogServiceImpl extends BaseServiceImpl<IcWorkLogDao, IcWorkLo |
|
|
|
public IcWorkLogDTO get(String id) { |
|
|
|
IcWorkLogEntity entity = baseDao.selectById(id); |
|
|
|
IcWorkLogDTO dto = ConvertUtils.sourceToTarget(entity, IcWorkLogDTO.class); |
|
|
|
if (StringUtils.isNotBlank(entity.getGridId())) { |
|
|
|
CustomerGridEntity grid = customerGridDao.selectById(entity.getGridId()); |
|
|
|
dto.setGridName(grid.getGridName()); |
|
|
|
} |
|
|
|
|
|
|
|
Map<String, Object> params = new HashMap<>(2); |
|
|
|
params.put("logId", id); |
|
|
|
List<IcWorkLogFileDTO> files = icWorkLogFileService.list(params); |
|
|
@ -132,14 +143,9 @@ public class IcWorkLogServiceImpl extends BaseServiceImpl<IcWorkLogDao, IcWorkLo |
|
|
|
dto.setCreatedUser(staffInfo.getData().getRealName()); |
|
|
|
dto.setMobile(staffInfo.getData().getMobile()); |
|
|
|
} |
|
|
|
// 查询网格信息
|
|
|
|
CustomerGridFormDTO customerGridFormDTO = new CustomerGridFormDTO(); |
|
|
|
customerGridFormDTO.setGridId(dto.getGridId()); |
|
|
|
GridDetailResultDTO gridDetailResultDTO = customerGridDao.griddetail(customerGridFormDTO); |
|
|
|
if (gridDetailResultDTO != null) { |
|
|
|
dto.setAgencyId(gridDetailResultDTO.getAgencyId()); |
|
|
|
dto.setPids(gridDetailResultDTO.getPIds()); |
|
|
|
} |
|
|
|
// 组织机构处理
|
|
|
|
orgHandle(dto); |
|
|
|
|
|
|
|
IcWorkLogEntity entity = ConvertUtils.sourceToTarget(dto, IcWorkLogEntity.class); |
|
|
|
insert(entity); |
|
|
|
|
|
|
@ -150,14 +156,9 @@ public class IcWorkLogServiceImpl extends BaseServiceImpl<IcWorkLogDao, IcWorkLo |
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void update(IcWorkLogDTO dto) { |
|
|
|
// 查询网格信息
|
|
|
|
CustomerGridFormDTO customerGridFormDTO = new CustomerGridFormDTO(); |
|
|
|
customerGridFormDTO.setGridId(dto.getGridId()); |
|
|
|
GridDetailResultDTO gridDetailResultDTO = customerGridDao.griddetail(customerGridFormDTO); |
|
|
|
if (gridDetailResultDTO != null) { |
|
|
|
dto.setAgencyId(gridDetailResultDTO.getAgencyId()); |
|
|
|
dto.setPids(gridDetailResultDTO.getPIds()); |
|
|
|
} |
|
|
|
// 组织机构处理
|
|
|
|
orgHandle(dto); |
|
|
|
|
|
|
|
IcWorkLogEntity entity = ConvertUtils.sourceToTarget(dto, IcWorkLogEntity.class); |
|
|
|
updateById(entity); |
|
|
|
|
|
|
@ -195,4 +196,31 @@ public class IcWorkLogServiceImpl extends BaseServiceImpl<IcWorkLogDao, IcWorkLo |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 组织机构处理 |
|
|
|
* |
|
|
|
* @param dto |
|
|
|
* @return |
|
|
|
* @author zhy |
|
|
|
* @date 2022/8/12 17:30 |
|
|
|
*/ |
|
|
|
private void orgHandle(IcWorkLogDTO dto) { |
|
|
|
if (StringUtils.isNotBlank(dto.getGridId())) { |
|
|
|
// 查询网格信息
|
|
|
|
CustomerGridFormDTO customerGridFormDTO = new CustomerGridFormDTO(); |
|
|
|
customerGridFormDTO.setGridId(dto.getGridId()); |
|
|
|
GridDetailResultDTO gridDetailResultDTO = customerGridDao.griddetail(customerGridFormDTO); |
|
|
|
if (gridDetailResultDTO != null) { |
|
|
|
dto.setAgencyId(gridDetailResultDTO.getAgencyId()); |
|
|
|
dto.setPids(gridDetailResultDTO.getPIds()); |
|
|
|
} |
|
|
|
} else { |
|
|
|
CustomerAgencyEntity agency = customerAgencyDao.getAgencyByUserId(loginUserUtil.getLoginUserId(), loginUserUtil.getLoginUserCustomerId()); |
|
|
|
if (agency != null) { |
|
|
|
dto.setAgencyId(agency.getId()); |
|
|
|
dto.setPids(agency.getPids()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |