Commit 201a50a1 authored by zhuangxinwei's avatar zhuangxinwei

小区封控,方舱人员管理导入

parent 0eba13ce
......@@ -141,17 +141,17 @@ public class FcryController extends BaseController
ExcelUtil.setClassExcelAttribute( clazz,"isPositive","combo",isPositive);
String[] positiveOnly = {"是","否"};
ExcelUtil.setClassExcelAttribute( clazz,"positiveOnly","combo",positiveOnly);
List<String> streetList = fkqkService.selectStreet();
String[] list = streetList.toArray(new String[]{});
ExcelUtil.setClassExcelAttribute( clazz,"street","combo",list);
List<String> areaList = fkqkService.selectArea();
String[] area = areaList.toArray(new String[]{});
ExcelUtil.setClassExcelAttribute( clazz,"area","combo",area);
List<String> fcList = fkqkService.selectFc();
String[] fc = fcList.toArray(new String[]{});
ExcelUtil.setClassExcelAttribute( clazz,"fcPlace","combo",fc);
// List<String> streetList = fkqkService.selectStreet();
// String[] list = streetList.toArray(new String[]{});
// ExcelUtil.setClassExcelAttribute( clazz,"street","combo",list);
//
// List<String> areaList = fkqkService.selectArea();
// String[] area = areaList.toArray(new String[]{});
// ExcelUtil.setClassExcelAttribute( clazz,"area","combo",area);
//
// List<String> fcList = fkqkService.selectFc();
// String[] fc = fcList.toArray(new String[]{});
// ExcelUtil.setClassExcelAttribute( clazz,"fcPlace","combo",fc);
util.importTemplateExcel(response, "方舱人员导入模板");
}
......
......@@ -131,8 +131,8 @@ public class FkqkController extends BaseController
ExcelUtil<FkqkDTO> util = new ExcelUtil<FkqkDTO>(FkqkDTO.class);
Class<? extends FkqkDTO> clazz = new FkqkDTO().getClass();
List<String> streetList = fkqkService.selectStreet();
String[] list = streetList.toArray(new String[]{});
ExcelUtil.setClassExcelAttribute( clazz,"street","combo",list);
// String[] list = streetList.toArray(new String[]{});
// ExcelUtil.setClassExcelAttribute( clazz,"street","combo",list);
String[] isJf = {"是","否"};
ExcelUtil.setClassExcelAttribute( clazz,"isJf","combo",isJf);
util.importTemplateExcel(response, "小区封控情况导入模板");
......
......@@ -58,13 +58,11 @@ public class Fcry extends BaseEntity
@Excel(name = "街道/镇")
private String street;
/** 街道/镇 */
// @Excel(name = "居委会")
private String committee;
/** 小区/村名称 */
@Excel(name = "小区/村名称")
private String community;
@Excel(name = "居委会")
private String committee;
/** 楼号单元号门牌号 */
@Excel(name = "楼号")
private String floor;
......
......@@ -22,7 +22,7 @@ public class FcryDTO extends BaseEntity
private Long id;
/** 方舱名称 */
@Excel(name = "方舱名称",dictType = "fcPlace",combo = "")
@Excel(name = "方舱名称")
private String fcPlace;
/** 房间号 */
......@@ -51,13 +51,14 @@ public class FcryDTO extends BaseEntity
private String phone;
/** 居住地所在区 */
@Excel(name = "居住地所在区",dictType = "residential_area",combo = "")
@Excel(name = "居住地所在区")
private String area;
/** 街道/镇 */
@Excel(name = "街道/镇",dictType = "street_town",combo = "")
@Excel(name = "街道/镇")
private String street;
@Excel(name = "居委会")
private String committee;
/** 小区/村名称 */
@Excel(name = "小区/村名称")
private String community;
......@@ -92,8 +93,15 @@ public class FcryDTO extends BaseEntity
/** 删除标志(0代表存在 2代表删除) */
private String delFlag;
public String getCommittee() {
return committee;
}
public void setCommittee(String committee) {
this.committee = committee;
}
public String getRemark() {
public String getRemark() {
return remark;
}
......
......@@ -23,13 +23,13 @@ public class Fkqk extends BaseEntity
@Excel(name = "小区名称")
private String community;
/** 所在区 */
// @Excel(name = "所在区")
@Excel(name = "所在区")
private String area;
/** 街道/镇名称 */
@Excel(name = "街道/镇名称")
private String street;
// @Excel(name = "居委会")
@Excel(name = "居委会")
private String committee;
/** 楼号 */
......
......@@ -24,12 +24,13 @@ public class FkqkDTO extends BaseEntity
@Excel(name = "小区名称")
private String community;
/** 所在区 */
// @Excel(name = "所在区")
@Excel(name = "所在区")
private String area;
/** 街道/镇名称 */
@Excel(name = "街道/镇名称" ,dictType = "street",combo = "")
@Excel(name = "街道/镇名称")
private String street;
@Excel(name = "居委会")
private String committee;
/** 楼号 */
@Excel(name = "楼号")
private String floor;
......@@ -79,6 +80,14 @@ public class FkqkDTO extends BaseEntity
/** 错误提示 */
private String tips;
public String getCommittee() {
return committee;
}
public void setCommittee(String committee) {
this.committee = committee;
}
public String getTips() {
return tips;
}
......
......@@ -63,4 +63,6 @@ public interface FcryMapper
List<Fcry> selectFcryByCard(@Param("cardNo") String cardNo);
void insertBatchFcry(@Param("list")List<Fcry> trueList);
void updateBatchFcry(@Param("list")List<Fcry> updateList);
}
......@@ -8,16 +8,13 @@ import com.ruoyi.common.core.domain.entity.SysDictData;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.*;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.domain.FcryDTO;
import com.ruoyi.system.domain.Fkqk;
import com.ruoyi.system.domain.Zlqk;
import com.ruoyi.system.domain.*;
import com.ruoyi.system.mapper.SysDictDataMapper;
import com.ruoyi.system.mapper.SysUserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.common.annotation.DataScope;
import com.ruoyi.system.mapper.FcryMapper;
import com.ruoyi.system.domain.Fcry;
import com.ruoyi.system.service.IFcryService;
import javax.servlet.http.HttpServletResponse;
......@@ -136,46 +133,84 @@ public class FcryServiceImpl implements IFcryService
}
List<Fcry> trueList = new ArrayList<>();
List<Fcry> failureList = new ArrayList<>();
List<Fcry> updateList = new ArrayList<>();
for (Fcry fcry : residentialList){
if (StringUtils.isNotEmpty(fcry.getFcPlace()) && StringUtils.isNotEmpty(fcry.getPeopleType())
&& StringUtils.isNotEmpty(fcry.getJzName()) && StringUtils.isNotEmpty(fcry.getCardNo())
&& StringUtils.isNotEmpty(fcry.getPositiveOnly()) && StringUtils.isNotEmpty(fcry.getIsPositive())
&& StringUtils.isNotEmpty(fcry.getPhone()) && StringUtils.isNotEmpty(fcry.getArea())
&& fcry.getZcTime() != null){
if (StringUtils.isNotEmpty(fcry.getCommunity())){ //如果小区不为空,去数据字典匹配value
List<SysDictData> community = DictUtils.getDictCache("community");
List<String> values = community.stream().filter(l->fcry.getCommunity().equals(l.getDictLabel()))
.map(SysDictData::getDictValue).collect(Collectors.toList());
if (!values.isEmpty())
fcry.setCommunity(values.get(0));
else {
failureList.add(fcry);
continue;
}
}
if (StringUtils.isNotEmpty(fcry.getCommittee())){ //如果居委会不为空,去数据字典匹配value
List<SysDictData> committee = DictUtils.getDictCache("committee");
List<String> values = committee.stream().filter(l->fcry.getCommittee().equals(l.getDictLabel()))
.map(SysDictData::getDictValue).collect(Collectors.toList());
if (!values.isEmpty())
fcry.setCommittee(values.get(0));
else {
failureList.add(fcry);
continue;
}
}
if (StringUtils.isNotEmpty(fcry.getStreet())){ //如果街道镇不为空,去数据字典匹配value
List<SysDictData> street = DictUtils.getDictCache("street_town");
List<String> values = street.stream().filter(l->fcry.getStreet().equals(l.getDictLabel()))
.map(SysDictData::getDictValue).collect(Collectors.toList());
if (!values.isEmpty())
fcry.setStreet(values.get(0));
else {
failureList.add(fcry);
continue;
}
}
if (StringUtils.isNotEmpty(fcry.getArea())){ //如果区不为空,去数据字典匹配value
List<SysDictData> area = DictUtils.getDictCache("residential_area");
List<String> values = area.stream().filter(l->fcry.getArea().equals(l.getDictLabel()))
.map(SysDictData::getDictValue).collect(Collectors.toList());
if (!values.isEmpty())
fcry.setArea(values.get(0));
else {
failureList.add(fcry);
continue;
}
}
if (StringUtils.isNotEmpty(fcry.getFcPlace())){ //如果方舱不为空,去数据字典匹配value
List<SysDictData> fcPlace = DictUtils.getDictCache("shelters");
List<String> values = fcPlace.stream().filter(l->fcry.getFcPlace().equals(l.getDictLabel()))
.map(SysDictData::getDictValue).collect(Collectors.toList());
if (!values.isEmpty())
fcry.setFcPlace(values.get(0));
else {
failureList.add(fcry);
continue;
}
}
List<Fcry> fcrys = fcryMapper.selectFcryByCard(fcry.getCardNo());
if (!fcrys.isEmpty())
failureList.add(fcry);
else {
fcrys = residentialList.stream().filter(l -> fcry.getCardNo().equals(l.getCardNo())).collect(Collectors.toList());
if (fcrys.size()>1)
failureList.add(fcry);
updateList.add(fcry);
else {
// 查询街道/镇名称是否在字典中
SysDictData sysDictData = new SysDictData();
sysDictData.setStatus("0");
sysDictData.setDictLabel(fcry.getStreet());
sysDictData.setDictType("street_town");
List<SysDictData> sysDictDataHave = sysDictDataMapper.selectDictDataList(sysDictData);
if (sysDictDataHave.isEmpty()){
if (!CheckUtils.checkPhone(fcry.getPhone())) {
failureList.add(fcry);
}else {
// 查询方舱名称是否在字典中
SysDictData sysDictDataFc = new SysDictData();
sysDictData.setStatus("0");
sysDictData.setDictLabel(fcry.getFcPlace());
sysDictData.setDictType("shelter_name");
List<SysDictData> sysDictDataFcHave = sysDictDataMapper.selectDictDataList(sysDictData);
if (sysDictDataFcHave.isEmpty()){
failureList.add(fcry);
}else {
fcry.setStreet(sysDictDataHave.get(0).getDictValue());
fcry.setFcPlace(sysDictDataFcHave.get(0).getDictValue());
if (CheckUtils.checkCard(fcry.getCardNo()))
fcry.setCheckCard("正确");
else
fcry.setCheckCard("不正确");
trueList.add(fcry);
}
if (CheckUtils.checkCard(fcry.getCardNo()))
fcry.setCheckCard("正确");
else
fcry.setCheckCard("不正确");
trueList.add(fcry);
}
}
}
......@@ -183,6 +218,13 @@ public class FcryServiceImpl implements IFcryService
failureList.add(fcry);
}
}
if (!updateList.isEmpty()) {
for (Fcry fcry : updateList) {
fcry.setCreateBy(DataUtils.getValue(fcry.getArea(), fcry.getStreet(), fcry.getCommittee()));
fcry.setUpdateTime(DateUtils.getNowDate());
}
fcryMapper.updateBatchFcry(updateList);
}
if (!trueList.isEmpty()){
for (Fcry fcry1 : trueList) {
fcry1.setCreateBy(String.valueOf(SecurityUtils.getUserId()));
......
......@@ -6,18 +6,16 @@ import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
import com.ruoyi.common.core.domain.entity.SysDictData;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.DataUtils;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.*;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.domain.Zlqk;
import com.ruoyi.system.mapper.SysDictDataMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.annotation.DataScope;
import com.ruoyi.system.mapper.FkqkMapper;
import com.ruoyi.system.domain.Fkqk;
......@@ -136,15 +134,54 @@ public class FkqkServiceImpl implements IFkqkService
Date now;
Calendar c = Calendar.getInstance();
now = new Date(c.get(Calendar.YEAR), c.get(Calendar.MONTH) + 1, c.get(Calendar.DAY_OF_MONTH));
// 查询街道/镇名称是否在字典中
SysDictData sysDictData = new SysDictData();
sysDictData.setStatus("0");
sysDictData.setDictLabel(fkqk.getStreet());
sysDictData.setDictType("street_town");
List<SysDictData> sysDictDataHave = sysDictDataMapper.selectDictDataList(sysDictData);
if (sysDictDataHave.isEmpty()){
failureList.add(fkqk);
}else if (fkqk.getCommunity().length() > 30){
String createBy = DataUtils.getValue(fkqk.getArea(), fkqk.getStreet(), fkqk.getCommittee());
// if (createBy.equals("null"))
// throw new ServiceException("所选居住地、街道、社区不存在");
if (StringUtils.isNotEmpty(fkqk.getCommunity())){ //如果小区不为空,去数据字典匹配value
List<SysDictData> community = DictUtils.getDictCache("community");
List<String> values = community.stream().filter(l->fkqk.getCommunity().equals(l.getDictLabel()))
.map(SysDictData::getDictValue).collect(Collectors.toList());
if (!values.isEmpty())
fkqk.setCommunity(values.get(0));
else {
failureList.add(fkqk);
continue;
}
}
if (StringUtils.isNotEmpty(fkqk.getCommittee())){ //如果居委会不为空,去数据字典匹配value
List<SysDictData> committee = DictUtils.getDictCache("committee");
List<String> values = committee.stream().filter(l->fkqk.getCommittee().equals(l.getDictLabel()))
.map(SysDictData::getDictValue).collect(Collectors.toList());
if (!values.isEmpty())
fkqk.setCommittee(values.get(0));
else {
failureList.add(fkqk);
continue;
}
}
if (StringUtils.isNotEmpty(fkqk.getStreet())){ //如果街道镇不为空,去数据字典匹配value
List<SysDictData> street = DictUtils.getDictCache("street_town");
List<String> values = street.stream().filter(l->fkqk.getStreet().equals(l.getDictLabel()))
.map(SysDictData::getDictValue).collect(Collectors.toList());
if (!values.isEmpty())
fkqk.setStreet(values.get(0));
else {
failureList.add(fkqk);
continue;
}
}
if (StringUtils.isNotEmpty(fkqk.getArea())){ //如果区不为空,去数据字典匹配value
List<SysDictData> area = DictUtils.getDictCache("residential_area");
List<String> values = area.stream().filter(l->fkqk.getArea().equals(l.getDictLabel()))
.map(SysDictData::getDictValue).collect(Collectors.toList());
if (!values.isEmpty())
fkqk.setArea(values.get(0));
else {
failureList.add(fkqk);
continue;
}
}
if (fkqk.getCommunity().length() > 30){
failureList.add(fkqk);
}else if (fkqk.getFloor().length() > 30){
failureList.add(fkqk);
......@@ -155,8 +192,8 @@ public class FkqkServiceImpl implements IFkqkService
}else if (fkqk.getRemark().length() > 200){
failureList.add(fkqk);
}else {
fkqk.setStreet(sysDictDataHave.get(0).getDictValue());
fkqk.setCreateBy(String.valueOf(SecurityUtils.getUserId()));
// fkqk.setStreet(sysDictDataHave.get(0).getDictValue());
fkqk.setCreateBy(createBy);
fkqk.setCreateTime(DateUtils.getNowDate());
trueList.add(fkqk);
}
......
......@@ -179,6 +179,40 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</trim>
where id = #{id}
</update>
<update id="updateBatchFcry" parameterType="com.ruoyi.system.domain.Fcry">
<foreach item="item" index="index" collection="list" separator=",">
update fcry
<trim prefix="SET" suffixOverrides=",">
<if test="fcPlace != null">fc_place = #{fcPlace},</if>
<if test="room != null">room = #{room},</if>
<if test="jzName != null">jz_name = #{jzName},</if>
<if test="cardNo != null">card_no = #{cardNo},</if>
<if test="phone != null">phone = #{phone},</if>
<if test="area != null">area = #{area},</if>
<if test="street != null">street = #{street},</if>
<if test="community != null">community = #{community},</if>
<if test="unit != null">unit = #{unit},</if>
<if test="zrTime != null">zr_time = #{zrTime},</if>
<if test="zcTime != null">zc_time = #{zcTime},</if>
<if test="glPlace != null">gl_place = #{glPlace},</if>
<if test="status != null">status = #{status},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="doorplate != null">doorplate = #{doorplate},</if>
<if test="floor != null">floor = #{floor},</if>
<if test="committee != null">committee = #{committee},</if>
<if test="positiveOnly != null">positive_only = #{positiveOnly},</if>
<if test="isPositive != null">is_positive = #{isPositive},</if>
<if test="checkCard != null">check_card = #{checkCard},</if>
<if test="peopleType != null">people_type = #{peopleType},</if>
</trim>
where card_no = #{item.cardNo}
</foreach>
</update>
<delete id="deleteFcryById" parameterType="Long">
delete from fcry where id = #{id}
......
......@@ -119,9 +119,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</trim>
</insert>
<insert id="insertBatchFkqk" parameterType="Fkqk">
insert into fkqk (street,community,floor,unit,fk_time,jf_time,create_by,create_time,remark,fk_detailed,fk_hs,fk_rs,is_jf,real_time,hs_time) values
insert into fkqk (area,committee,street,community,floor,unit,fk_time,jf_time,create_by,create_time,remark,fk_detailed,fk_hs,fk_rs,is_jf,real_time,hs_time) values
<foreach item="item" index="index" collection="list" separator=",">
(#{item.street},#{item.community},#{item.floor},#{item.unit},#{item.fkTime},#{item.jfTime},
(#{item.area},#{item.committee},#{item.street},#{item.community},#{item.floor},#{item.unit},#{item.fkTime},#{item.jfTime},
#{item.createBy},#{item.createTime},#{item.remark},#{item.fkDetailed},#{item.fkHs},#{item.fkRs},#{item.isJf},#{item.realTime},#{item.hsTime})
</foreach>
</insert>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment