| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.apache.logging.log4j.util.Strings; |
| | | import org.springblade.common.constant.CommonConstant; |
| | | import org.springblade.common.param.CommonParamSet; |
| | | import org.springblade.core.secure.utils.AuthUtil; |
| | | import org.springblade.core.tool.utils.BeanUtil; |
| | | import org.springblade.modules.place.entity.PlaceEntity; |
| | | import org.springblade.modules.place.entity.PlacePractitionerEntity; |
| | | import org.springblade.modules.place.excel.ImportPractitionerExcel; |
| | | import org.springblade.modules.place.mapper.PlacePractitionerMapper; |
| | | import org.springblade.modules.place.service.IPlacePractitionerService; |
| | | import org.springblade.modules.place.service.IPlaceService; |
| | | import org.springblade.modules.place.vo.PlacePractitionerVO; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * 场所从业人员 服务实现类 |
| | |
| | | */ |
| | | @Service |
| | | public class PlacePractitionerServiceImpl extends ServiceImpl<PlacePractitionerMapper, PlacePractitionerEntity> implements IPlacePractitionerService { |
| | | |
| | | @Autowired |
| | | private IPlaceService placeService; |
| | | |
| | | @Override |
| | | public IPage<PlacePractitionerVO> selectPlacePractitionerPage(IPage<PlacePractitionerVO> page, PlacePractitionerVO placePractitioner) { |
| | |
| | | .eq(PlacePractitionerEntity::getIsDeleted,0)); |
| | | return update; |
| | | } |
| | | |
| | | @Override |
| | | public String importPractitioner(List<ImportPractitionerExcel> data, boolean b) { |
| | | int totalNum = data.size(); |
| | | int importNum = 0; |
| | | int updateNum = 0; |
| | | int errorNum = 0; |
| | | for (ImportPractitionerExcel placeExcel : data) { |
| | | if (Strings.isBlank(placeExcel.getHouseCode()) || Strings.isBlank(placeExcel.getHouseCode())) { |
| | | errorNum++; |
| | | continue; |
| | | } |
| | | PlacePractitionerEntity placeEntity = Objects.requireNonNull(BeanUtil.copy(placeExcel, PlacePractitionerEntity.class)); |
| | | // 查询场所是否存在 |
| | | PlaceEntity placeServiceOne = placeService.getOne(Wrappers.<PlaceEntity>lambdaQuery() |
| | | .eq(PlaceEntity::getHouseCode, placeExcel.getHouseCode())); |
| | | if (placeServiceOne != null) { |
| | | placeEntity.setPlaceId(placeServiceOne.getId()); |
| | | boolean save = save(placeEntity); |
| | | if (save) { |
| | | importNum++; |
| | | } else { |
| | | errorNum++; |
| | | } |
| | | } else { |
| | | errorNum++; |
| | | continue; |
| | | } |
| | | } |
| | | StringBuilder builder = new StringBuilder("导入完成!"); |
| | | builder.append("其中本次表格共有 ").append(totalNum).append(" 条数据,") |
| | | .append("成功导入 ").append(importNum).append(" 条数据。"); |
| | | if (updateNum > 0) { |
| | | builder.append("其中有 ").append(updateNum).append(" 条数据已存在。"); |
| | | } |
| | | if (errorNum > 0) { |
| | | builder.append("共有 ").append(errorNum).append(" 条数据由于无企业(店铺)名称信息或无地址编号未导入!"); |
| | | } |
| | | return builder.toString(); |
| | | } |
| | | } |