|
|
@ -29,6 +29,7 @@ import com.epmet.dto.form.EnterprisePageFormDTO; |
|
|
|
import com.epmet.dto.form.EnterprisePatrolFormDTO; |
|
|
|
import com.epmet.dto.form.ImportTaskCommonFormDTO; |
|
|
|
import com.epmet.dto.result.*; |
|
|
|
import com.epmet.entity.IcEnterpriseChangeRecordEntity; |
|
|
|
import com.epmet.entity.IcEnterpriseEntity; |
|
|
|
import com.epmet.entity.IcEnterprisePatrolAttachmentEntity; |
|
|
|
import com.epmet.entity.IcEnterprisePatrolRecordEntity; |
|
|
@ -38,6 +39,7 @@ import com.epmet.feign.EpmetAdminOpenFeignClient; |
|
|
|
import com.epmet.feign.EpmetCommonServiceOpenFeignClient; |
|
|
|
import com.epmet.feign.OssFeignClient; |
|
|
|
import com.epmet.service.CoverageService; |
|
|
|
import com.epmet.service.IcEnterpriseChangeRecordService; |
|
|
|
import com.epmet.service.IcEnterpriseService; |
|
|
|
import com.github.pagehelper.PageHelper; |
|
|
|
import com.github.pagehelper.PageInfo; |
|
|
@ -90,6 +92,8 @@ public class IcEnterpriseServiceImpl extends BaseServiceImpl<IcEnterpriseDao, Ic |
|
|
|
private CoverageService coverageService; |
|
|
|
@Autowired |
|
|
|
private CustomerGridDao customerGridDao; |
|
|
|
@Autowired |
|
|
|
private IcEnterpriseChangeRecordService icEnterpriseChangeRecordService; |
|
|
|
|
|
|
|
/** |
|
|
|
* 企事业单位巡查】新增/编辑 |
|
|
@ -123,6 +127,10 @@ public class IcEnterpriseServiceImpl extends BaseServiceImpl<IcEnterpriseDao, Ic |
|
|
|
String agencyName = null != orginAgencyInfo ? orginAgencyInfo.getOrganizationName() : StrConstant.EPMETY_STR; |
|
|
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "", String.format("修改失败,当前场所属于%s", agencyName)); |
|
|
|
} |
|
|
|
|
|
|
|
// 历史记录
|
|
|
|
log(origin,"UPD"); |
|
|
|
|
|
|
|
enterpriseEntity.setId(formDTO.getEnterpriseId()); |
|
|
|
//获取一下最新的巡检时间和巡检结果
|
|
|
|
LambdaQueryWrapper<IcEnterprisePatrolRecordEntity> queryWrapper = new LambdaQueryWrapper(); |
|
|
@ -258,12 +266,17 @@ public class IcEnterpriseServiceImpl extends BaseServiceImpl<IcEnterpriseDao, Ic |
|
|
|
public void delete(String enterpriseId, String customerId, String userId) { |
|
|
|
//如果是编辑判断下权限要删除的记录的agencyId要与当前登录用户的agencyId一致
|
|
|
|
IcEnterpriseEntity origin = baseDao.selectById(enterpriseId); |
|
|
|
|
|
|
|
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(customerId, userId); |
|
|
|
if (!staffInfo.getAgencyId().equals(origin.getAgencyId())) { |
|
|
|
AgencyInfoCache orginAgencyInfo = CustomerOrgRedis.getAgencyInfo(origin.getAgencyId()); |
|
|
|
String agencyName = null != orginAgencyInfo ? orginAgencyInfo.getOrganizationName() : StrConstant.EPMETY_STR; |
|
|
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "", String.format("删除失败,当前场所属于%s", agencyName)); |
|
|
|
} |
|
|
|
|
|
|
|
// 历史记录
|
|
|
|
log(origin,"DEL"); |
|
|
|
|
|
|
|
baseDao.deleteById(enterpriseId); |
|
|
|
} |
|
|
|
|
|
|
@ -411,4 +424,26 @@ public class IcEnterpriseServiceImpl extends BaseServiceImpl<IcEnterpriseDao, Ic |
|
|
|
public List<IcEnterpriseEntity> selectForUniqueName(String gridId, String placeOrgName, String enterpriseId) { |
|
|
|
return baseDao.selectForUniqueName(gridId, placeOrgName, enterpriseId); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 记录操作日志 |
|
|
|
* |
|
|
|
* @param origin |
|
|
|
* @param type |
|
|
|
* @return void |
|
|
|
* @author zhy |
|
|
|
* @date 2022/8/16 15:36 |
|
|
|
*/ |
|
|
|
private void log(IcEnterpriseEntity origin, String type){ |
|
|
|
// 历史记录
|
|
|
|
IcEnterpriseChangeRecordEntity record = ConvertUtils.sourceToTarget(origin, IcEnterpriseChangeRecordEntity.class); |
|
|
|
record.setId(null); |
|
|
|
record.setCreatedBy(null); |
|
|
|
record.setCreatedTime(null); |
|
|
|
record.setUpdatedBy(null); |
|
|
|
record.setUpdatedTime(null); |
|
|
|
record.setOriginId(origin.getId()); |
|
|
|
record.setType(type); |
|
|
|
icEnterpriseChangeRecordService.insert(record); |
|
|
|
} |
|
|
|
} |