101captain
2022-01-21 94c34f08015c3f5f4d839354958aea88b31473a0
Merge branch 'test' of http://gitlab.nhys.cdnhxx.com/root/zhihuishequ into test
1个文件已添加
17个文件已修改
486 ■■■■ 已修改文件
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/listen/ComMngPopulationTempFilledExcelListen.java 238 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/community/microCommercialStreet/McsGameDTO.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/microCommercialStreet/McsCouponVO.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/microCommercialStreet/McsGameVO.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/microCommercialStreet/VerifiedReturnVO.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/service/community/CommunityService.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/community_backstage/src/main/java/com/panzhihua/community_backstage/api/PopulationApi.java 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/CommonDataApi.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/McsGameDAO.java 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/entity/McsGame.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/ComMngPopulationService.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngPopulationServiceImpl.java 68 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/McsGameServiceImpl.java 25 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComMngPopulationDOMapper.xml 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/McsCouponMapper.xml 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/McsGameMapper.xml 44 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/McsMerchantMapper.xml 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/service/impl/UserServiceImpl.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/listen/ComMngPopulationTempFilledExcelListen.java
New file
@@ -0,0 +1,238 @@
package com.panzhihua.common.listen;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.data.redis.core.ValueOperations;
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
import com.alibaba.fastjson.JSONArray;
import com.google.common.collect.Lists;
import com.panzhihua.common.constants.Constants;
import com.panzhihua.common.enums.PopulPersonTypeEnum;
import com.panzhihua.common.exceptions.ServiceException;
import com.panzhihua.common.model.vos.R;
import com.panzhihua.common.model.vos.community.ComMngPopulationMistakeExcelVO;
import com.panzhihua.common.model.vos.community.ComMngPopulationServeExcelVO;
import com.panzhihua.common.service.community.CommunityService;
import com.panzhihua.common.utlis.ListUtils;
import com.panzhihua.common.utlis.PayUtil;
import com.panzhihua.common.utlis.StringUtils;
import lombok.extern.slf4j.Slf4j;
/**
 * @title: ComMngPopulationTempFilledExcelListen
 * @projectName: 成都呐喊信息技术有限公司-智慧社区项目
 * @description: 实有人口临时填充人员类型
 * @author: hans
 * @date: 2022/01/19 13:33
 */
@Slf4j
public class ComMngPopulationTempFilledExcelListen extends AnalysisEventListener<Map<Integer, String>> {
    /**
     * 每隔5条存储数据库,实际使用中可以3000条,然后清理list ,方便内存回收
     */
    private static final int BATCH_COUNT = 5000;
    private static int headSize = 0;
    List<Map<Integer, String>> list = new ArrayList<Map<Integer, String>>();
    private CommunityService communityService;
    private Long communityId;
    private Long userId;
    private Map<Integer, String> headData;
    private StringRedisTemplate stringRedisTemplate;
    public ComMngPopulationTempFilledExcelListen(CommunityService communityService, Long communityId, Long userId,
                                                 StringRedisTemplate stringRedisTemplate) {
        this.communityService = communityService;
        this.communityId = communityId;
        this.userId = userId;
        this.stringRedisTemplate = stringRedisTemplate;
    }
    @Override
    public void invoke(Map<Integer, String> data, AnalysisContext context) {
        list.add(data);
        if (list.size() >= BATCH_COUNT) {
            saveData();
            list.clear();
        }
    }
    /**
     * 这里会一行行的返回头
     *
     * @param headMap
     * @param context
     */
    @Override
    public void invokeHeadMap(Map<Integer, String> headMap, AnalysisContext context) {
        headSize = headMap.size();
        headData = headMap;
    }
    @Override
    public void doAfterAllAnalysed(AnalysisContext context) {
        saveData();
        log.info("所有数据解析完成!");
    }
    /**
     * 不是固定的列只能手动处理
     */
    private void saveData() {
        log.info("开始填充历史数据人员类型");
        log.info("表格总数据:" + list.size());
        if (list.size() == 0) {
            throw new ServiceException("000", "数据为空!");
        }
        ValueOperations<String, String> valueOperations = stringRedisTemplate.opsForValue();
        String key = "POPULATION_FILLED_ERROR_LIST";
        int index = 2;
        try {
            ArrayList<ComMngPopulationServeExcelVO> voList = Lists.newArrayList();
            ArrayList<ComMngPopulationMistakeExcelVO> mistakes = Lists.newArrayList();
            for (Map<Integer, String> oneData : list) {
                ComMngPopulationServeExcelVO vo = new ComMngPopulationServeExcelVO();
                // 姓名和身份证都为空,为空户,无需操作,否则就解析年龄,性别,出生年月日
                if (StringUtils.isNotEmpty(oneData.get(0)) || StringUtils.isNotEmpty(oneData.get(1))) {
                    if (StringUtils.isEmpty(oneData.get(0))) {
                        ComMngPopulationMistakeExcelVO mistake = new ComMngPopulationMistakeExcelVO();
                        index++;
                        setMistake(oneData, mistake);
                        mistake.setMistake("名字不可为空,请填写姓名");
                        mistakes.add(mistake);
                        continue;
                    }
                    vo.setName(oneData.get(0));
                    if (StringUtils.isEmpty(oneData.get(1))) {
                        ComMngPopulationMistakeExcelVO mistake = new ComMngPopulationMistakeExcelVO();
                        index++;
                        setMistake(oneData, mistake);
                        mistake.setMistake("身份证号不可为空,请填写身份证号");
                        mistakes.add(mistake);
                        continue;
                    }
                    // 判断身份证号码位数
                    if (oneData.get(1).length() != 18) {
                        index++;
                        ComMngPopulationMistakeExcelVO mistake = new ComMngPopulationMistakeExcelVO();
                        setMistake(oneData, mistake);
                        mistake.setMistake("身份证号位数有误,请检查身份证号码是否正确");
                        mistakes.add(mistake);
                        continue;
                    }
                    vo.setCardNo(oneData.get(1).toUpperCase());
                }
                if (StringUtils.isNotEmpty(oneData.get(2))) {
                    Integer isOk = PopulPersonTypeEnum.getCodeByName(oneData.get(2));
                    if (isOk.equals(-1)) {
                        index++;
                        ComMngPopulationMistakeExcelVO mistake = new ComMngPopulationMistakeExcelVO();
                        setMistake(oneData, mistake);
                        mistake.setMistake("您填写的人员类型有误");
                        mistake.setPersonType(oneData.get(2));
                        mistakes.add(mistake);
                        continue;
                    }
                    vo.setPersonType(isOk);
                }
                // 将重复的数据进行MD5加密实现去重
                String distinct = vo.getName() + vo.getCardNo();
                try {
                    String distinctPass = PayUtil.MD5(distinct);
                    if (StringUtils.isNotEmpty(distinctPass)) {
                        vo.setDistinctPass(distinctPass);
                    }
                } catch (Exception e) {
                    log.error("组装MD5加密字段失败,数据表格行数:" + index);
                    continue;
                }
                voList.add(vo);
                index++;
            }
            // 根据list中的IdCard城市来去重
            List<ComMngPopulationServeExcelVO> newVoList =
                voList.stream().filter(ListUtils.distinctByKey(ComMngPopulationServeExcelVO::getDistinctPass))
                    .collect(Collectors.toList());
            log.info("开始进入业务层处理逻辑");
            R r = communityService.filledPopulationPersonType(newVoList, communityId, userId);
            log.info("业务层处理逻辑完成");
            if (!R.isOk(r)) {
                log.info("业务层处理成功");
                List<ComMngPopulationMistakeExcelVO> list =
                    JSONArray.parseArray(JSONArray.toJSONString(r.getData()), ComMngPopulationMistakeExcelVO.class);
                mistakes.addAll(list);
                log.info("将错误数据存入redis中");
                valueOperations.set(key, JSONArray.toJSONString(mistakes), 1, TimeUnit.HOURS);
                log.info("将错误数据存入redis中成功");
                throw new ServiceException("500", key);
            } else {
                log.info("业务层处理逻辑失败");
                if (!mistakes.isEmpty()) {
                    log.info("业务层处理逻辑失败,将错误数据缓存到redis中");
                    valueOperations.set(key, JSONArray.toJSONString(mistakes), 1, TimeUnit.HOURS);
                    log.info("业务层处理逻辑失败,将错误数据缓存到redis中成功");
                    throw new ServiceException("500", key);
                }
            }
        } catch (NumberFormatException e) {
            log.info("处理数据时失败");
            e.printStackTrace();
            log.error("数据格式有误,第" + index + "行");
            throw new ServiceException("500", "导入失败111");
        }
    }
    private void setMistake(Map<Integer, String> map, ComMngPopulationMistakeExcelVO vo) {
        vo.setName(map.get(0));
        vo.setCardNo(map.get(1));
        vo.setNation(map.get(2));
        vo.setPoliticalOutlook(map.get(3));
        vo.setIsRent(map.get(4));
        vo.setRelation(map.get(5));
        vo.setRoad(map.get(6));
        vo.setDoorNo(map.get(7));
        vo.setFloor(map.get(8));
        vo.setUnitNo(map.get(9));
        vo.setHouseNo(map.get(10));
        vo.setBuildPurpose(map.get(11));
        vo.setBuildArea(map.get(12));
        vo.setHouseStatus(map.get(13));
        vo.setHousePurpose(map.get(14));
        vo.setControlStatus(map.get(15));
        vo.setPhone(map.get(16));
        vo.setNativePlace(map.get(17));
        vo.setCultureLevel(map.get(18));
        vo.setMarriage(map.get(19));
        vo.setHealthy(map.get(20));
        vo.setBloodType(map.get(21));
        vo.setReligion(map.get(22));
        vo.setProfession(map.get(23));
        vo.setWorkCompany(map.get(24));
        vo.setOutOrLocal(map.get(25));
        vo.setCensusRegister(map.get(26));
        vo.setResidence(map.get(27));
        vo.setPersonType(map.get(28));
        vo.setCountry(map.get(29));
        vo.setStringOfDeparture(map.get(30));
        vo.setPersonStatus(map.get(31));
        vo.setMonthlyIncome(map.get(32));
        vo.setFamilyStatus(map.get(33));
        vo.setGoalInChina(map.get(34));
        vo.setStringOfArrival(map.get(35));
        vo.setRemark(map.get(36));
        vo.setIdCardPositive(map.get(37));
        vo.setIdCardBack(map.get(38));
        vo.setHouseHold(map.get(39));
        vo.setDeath(map.get(40));
    }
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/community/microCommercialStreet/McsGameDTO.java
@@ -40,7 +40,7 @@
    @NotNull(groups = {AddGroup.class}, message = "游戏类别不能为空")
    private Integer type;
    @ApiModelProperty("奖励类型(1.免费产品 2.免费服务)")
    @ApiModelProperty("奖励类型(1.免费领 2.产品试用 3.消费赠礼 4.优惠券)")
    private Integer awardType;
    @ApiModelProperty("戳戳币分配方式(1.随机分配 2.平均分配)")
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/microCommercialStreet/McsCouponVO.java
@@ -56,7 +56,7 @@
    @ApiModelProperty("游戏封面")
    private String cover;
    @ApiModelProperty("奖励类型(1.免费产品 2.免费服务)")
    @ApiModelProperty("奖励类型(1.免费领 2.产品试用 3.消费赠礼 4.优惠券)")
    private Integer awardType;
    @ApiModelProperty("戳戳币分配方式(1.随机分配 2.平均分配)")
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/microCommercialStreet/McsGameVO.java
@@ -34,7 +34,7 @@
    @ApiModelProperty("游戏类别(1.戳戳币游戏 2.体验游戏)")
    private Integer type;
    @ApiModelProperty("奖励类型(1.免费产品 2.免费服务)")
    @ApiModelProperty("奖励类型(1.免费领 2.产品试用 3.消费赠礼 4.优惠券)")
    private Integer awardType;
    @ApiModelProperty("戳戳币分配方式(1.随机分配 2.平均分配)")
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/microCommercialStreet/VerifiedReturnVO.java
@@ -41,6 +41,6 @@
    @ApiModelProperty("游戏封面")
    private String cover;
    @ApiModelProperty("奖励类型(1.免费产品 2.免费服务)")
    @ApiModelProperty("奖励类型(1.免费领 2.产品试用 3.消费赠礼 4.优惠券)")
    private Integer awardType;
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/service/community/CommunityService.java
@@ -8262,4 +8262,15 @@
    @GetMapping("/reserve/record/delete")
    R deleteRecord(@RequestParam("recordId")Long recordId);
    /**
     * 历史数据人员类型填充
     * @param newVoList
     * @param communityId
     * @param userId
     * @return
     */
    @PostMapping("/common/data/history/filled")
    R filledPopulationPersonType(@RequestBody List<ComMngPopulationServeExcelVO> newVoList,
                                 @RequestParam("communityId") Long communityId, @RequestParam("userId") Long userId);
}
springcloud_k8s_panzhihuazhihuishequ/community_backstage/src/main/java/com/panzhihua/community_backstage/api/PopulationApi.java
@@ -10,6 +10,7 @@
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import com.panzhihua.common.exceptions.ServiceException;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.StringRedisTemplate;
@@ -107,6 +108,28 @@
        return R.ok();
    }
    @ApiOperation(value = "excel填充旧数据的人员类型")
    @PostMapping(value = "/history/filled", consumes = "multipart/*", headers = "content-type=multipart/form-date")
    public R filledPopulationPersonType(@RequestParam MultipartFile file, HttpServletRequest request) {
        // 获取文件名
        String fileName = file.getOriginalFilename();
        log.info("传入文件名字【{}】", fileName);
        InputStream inputStream = null;
        try {
            inputStream = file.getInputStream();
            ComMngPopulationTempFilledExcelListen excelListen = new ComMngPopulationTempFilledExcelListen(
                    communityService, this.getCommunityId(), this.getLoginUserInfo().getUserId(), stringRedisTemplate);
            EasyExcel.read(inputStream, null, excelListen).sheet().doRead();
        } catch (IOException e) {
            log.error("填充旧数据的人员类型【{}】", e.getMessage());
            e.printStackTrace();
        } catch (ServiceException e) {
            log.error("错误数据【{}】", e.getMessage());
            return downloadErrorPopulation("POPULATION_FILLED_ERROR_LIST");
        }
        return R.ok();
    }
    @ApiOperation(value = "excel导入吸毒人员")
    @PostMapping(value = "/serve/importDrug", consumes = "multipart/*", headers = "content-type=multipart/form-date")
    public R importDrug(@RequestParam MultipartFile file, HttpServletRequest request) {
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/CommonDataApi.java
@@ -946,4 +946,17 @@
    public R detailHousesUser(@RequestParam("id") Long id) {
        return comMngPopulationHouseUserService.detail(id);
    }
    /**
     * 历史数据人员类型填充
     * @param newVoList
     * @param communityId
     * @param userId
     * @return
     */
    @PostMapping("/history/filled")
    public R filledPopulationPersonType(@RequestBody List<ComMngPopulationServeExcelVO> newVoList,
                                 @RequestParam("communityId") Long communityId, @RequestParam("userId") Long userId) {
        return comMngPopulationService.filledPopulationPersonType(newVoList, communityId, userId);
    }
}
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/McsGameDAO.java
@@ -78,15 +78,10 @@
    /**
     * h5分页游戏查询
     * @param page
     * @param minX
     * @param maxX
     * @param minY
     * @param maxY
     * @param pageMcsGameDTO
     * @return
     */
    IPage<McsGameVO> pageH5McsGame(@Param("page") Page page, @Param("minX") Double minX, @Param("maxX") Double maxX,
                                   @Param("minY") Double minY, @Param("maxY") Double maxY, @Param("pageMcsGameDTO") PageMcsGameDTO pageMcsGameDTO);
    IPage<McsGameVO> pageH5McsGame(@Param("page") Page page, @Param("pageMcsGameDTO") PageMcsGameDTO pageMcsGameDTO);
    /**
     * 游戏详情
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/entity/McsGame.java
@@ -36,7 +36,7 @@
     */
    private Integer type;
    /**
     * 奖励类型(1.免费产品 2.免费服务)
     * 奖励类型(1.免费领 2.产品试用 3.消费赠礼 4.优惠券)
     */
    private Integer awardType;
    /**
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/ComMngPopulationService.java
@@ -538,4 +538,13 @@
     * @return
     */
    R indexInfo(Long communityId);
    /**
     * 历史数据人员类型填充
     * @param newVoList
     * @param communityId
     * @param userId
     * @return
     */
    R filledPopulationPersonType(List<ComMngPopulationServeExcelVO> newVoList, Long communityId, Long userId);
}
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngPopulationServiceImpl.java
@@ -4479,6 +4479,10 @@
    private ComMngPopulationDO updatePopulationDO(ComMngPopulationServeExcelVO vo, ComMngPopulationDO populationDO,
        Long communityId, Long userId) {
        BeanUtils.copyProperties(vo, populationDO);
        Integer personType = vo.getPersonType();
        if (nonNull(personType)) {
            populationDO.setPersonType(personType.toString());
        }
        // List<String> userTag = vo.getUserTagStr().stream().map(userTagStr ->
        // userTagStr.split("\\(")[0]).collect(Collectors.toList());
        // //如果导入数据标签中有当前社区标签列表中不包含的标签,则删除
@@ -5010,6 +5014,10 @@
        ComMngVillageDO comMngVillageDO, Long userId) {
        ComMngPopulationDO populationDO = new ComMngPopulationDO();
        BeanUtils.copyProperties(vo, populationDO);
        Integer personType = vo.getPersonType();
        if (nonNull(personType)) {
            populationDO.setPersonType(personType.toString());
        }
        populationDO.setId(Snowflake.getId());
        // List<String> userTag = vo.getUserTagStr().stream().map(userTagStr ->
        // userTagStr.split("\\(")[0]).collect(Collectors.toList());
@@ -7975,6 +7983,66 @@
        return R.ok(indexInfo);
    }
    /**
     * 历史数据人员类型填充
     * @param list
     * @param communityId
     * @param userId
     * @return
     */
    @Override
    @Transactional(rollbackFor = Exception.class)
    public R filledPopulationPersonType(List<ComMngPopulationServeExcelVO> list, Long communityId, Long userId) {
        // 需要修改的人口集合
        List<ComMngPopulationDO> updateList = new ArrayList<>();
        log.info("开始处理导入数据");
        List<ComMngPopulationMistakeExcelVO> mistakes = new ArrayList<>();
        try {
            // 查询所有人口数据放入HashMap中
            List<ComMngPopulationDO> populationList = this.baseMapper.selectList(null);
            HashMap<String, Object> populationMap = new HashMap<>();
            populationList.forEach(population -> {
                String key = population.getCardNo();
                populationMap.put(key, population);
            });
            for (ComMngPopulationServeExcelVO vo : list) {
                // 判断实有人口是否已存在
                log.info("开始查询实有人口是否已存在");
                ComMngPopulationDO populationDO = null;
                String populationKey = vo.getCardNo();
                if (!isOnly(populationKey, populationMap)) {
                    // 存在实有人口信息,则更新人员类型
                    populationDO = (ComMngPopulationDO)populationMap.get(populationKey);
                    Integer personType = vo.getPersonType();
                    if (nonNull(personType)) {
                        populationDO.setPersonType(personType.toString());
                    }
                    populationDO.setUpdateBy(userId);
                    updateList.add(populationDO);
                } else {
                    // 不存在实有人口,返回
                    ComMngPopulationMistakeExcelVO mistake = new ComMngPopulationMistakeExcelVO();
                    BeanUtils.copyProperties(vo, mistake);
                    setMistake(mistake, vo);
                    mistake.setMistake("人口信息不存在,请下载实有人口模板导入");
                    mistakes.add(mistake);
                }
            }
        } catch (Exception e) {
            log.info("出现错误,错误原因:" + e.getMessage());
        }
        if (!updateList.isEmpty()) {
            log.info("执行数据库更新人口");
            this.baseMapper.updateAll(updateList);
            log.info("数据库更新人口完成");
        }
        if (!mistakes.isEmpty()) {
            log.info("返回错误数据");
            return R.fail(mistakes);
        }
        return R.ok(mistakes);
    }
    private void setMistake(ComMngPopulationMistakeExcelVO mvo, ComMngPopulationServeExcelVO vo) {
        mvo.setPoliticalOutlook(PopulPoliticalOutlookEnum.getCnDescByName(vo.getPoliticalOutlook()));
        mvo.setIsRent(PopulHouseUseEnum.getCnDescByName(vo.getIsRent()));
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/McsGameServiceImpl.java
@@ -2,7 +2,6 @@
import static java.util.Objects.isNull;
import static java.util.Objects.nonNull;
import static org.apache.commons.lang3.StringUtils.isNotEmpty;
import java.util.ArrayList;
import java.util.Date;
@@ -37,9 +36,7 @@
import com.panzhihua.service_community.entity.McsGame;
import com.panzhihua.service_community.entity.McsMerchant;
import com.panzhihua.service_community.service.McsGameService;
import com.panzhihua.service_community.util.NearbyUtil;
import com.panzhihua.service_community.util.QRCodeUtil;
import com.spatial4j.core.shape.Rectangle;
/**
 * (McsGame)表服务实现类
@@ -392,9 +389,13 @@
            //体验游戏
            Integer awardType = mcsGame.getAwardType();
            if (awardType.equals(1)) {
                mcsCoupon.setAward("免费产品");
                mcsCoupon.setAward("免费领");
            } else if (awardType.equals(2)) {
                mcsCoupon.setAward("产品试用");
            } else if (awardType.equals(3)) {
                mcsCoupon.setAward("消费赠礼");
            } else {
                mcsCoupon.setAward("免费服务");
                mcsCoupon.setAward("优惠券");
            }
        }
        int num = mcsCouponDAO.insert(mcsCoupon);
@@ -421,19 +422,7 @@
        Page page = new Page<>();
        page.setSize(pageMcsGameDTO.getPageSize());
        page.setCurrent(pageMcsGameDTO.getPageNum());
        String lat = pageMcsGameDTO.getLat();
        String lon = pageMcsGameDTO.getLon();
        Integer distance = pageMcsGameDTO.getDistance();
        IPage<McsGameVO> mcsGames;
        if (isNotEmpty(lat) && isNotEmpty(lon) && nonNull(distance)) {
            Rectangle rectangle = new NearbyUtil().getRectangle(pageMcsGameDTO.getDistance(),
                    Double.parseDouble(pageMcsGameDTO.getLon()), Double.parseDouble(pageMcsGameDTO.getLat()));
            mcsGames = this.baseMapper.pageH5McsGame(page, rectangle.getMinX(), rectangle.getMaxX(),
                    rectangle.getMinY(), rectangle.getMaxY(), pageMcsGameDTO);
        } else {
            mcsGames = this.baseMapper.pageH5McsGame(page, null, null, null, null, pageMcsGameDTO);
        }
        IPage<McsGameVO> mcsGames = this.baseMapper.pageH5McsGame(page, pageMcsGameDTO);
        return R.ok(mcsGames);
    }
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComMngPopulationDOMapper.xml
@@ -1185,13 +1185,13 @@
        (select count(id) from com_mng_population_community_tags where community_id = ${communityId} and label LIKE CONCAT('%','低保户','%')) as lowSecurityTotal ,
        (select count(id) from com_mng_population_community_tags where community_id = ${communityId} and label LIKE CONCAT('%','高龄老人','%')) as elderTotal ,
        (select count(id) from com_mng_population_community_tags where community_id = ${communityId} and label LIKE CONCAT('%','养老金人员','%')) as pensionTotal,
        (select count(cmpct.id) from com_mng_population_community_tags cmpct left join com_mng_population cmp on cmpct.population_id = cmp.id where cmpct.community_id = ${communityId} and cmp.person_type = 1) AS houseRegTotal,
        (select count(cmpct.id) from com_mng_population_community_tags cmpct left join com_mng_population cmp on cmpct.population_id = cmp.id where cmpct.community_id = ${communityId} and cmp.person_type = 2) AS leftTotal,
        (select count(cmpct.id) from com_mng_population_community_tags cmpct left join com_mng_population cmp on cmpct.population_id = cmp.id where cmpct.community_id = ${communityId} and cmp.person_type = 3) AS outOfTownTotal,
        (select count(cmpct.id) from com_mng_population_community_tags cmpct left join com_mng_population cmp on cmpct.population_id = cmp.id where cmpct.community_id = ${communityId} and cmp.person_type = 4) AS overseasTotal,
        (select count(cmpct.id) from com_mng_population_community_tags cmpct left join com_mng_population cmp on cmpct.population_id = cmp.id where cmpct.community_id = ${communityId} and cmp.person_type = 5) AS floatingTotal,
        (select count(cmpct.id) from com_mng_population_community_tags cmpct left join com_mng_population cmp on cmpct.population_id = cmp.id where cmpct.community_id = ${communityId} and cmp.person_type = 6) AS permanentTotal,
        (select count(cmpct.id) from com_mng_population_community_tags cmpct left join com_mng_population cmp on cmpct.population_id = cmp.id where cmpct.community_id = ${communityId} and cmp.person_type = 7) AS temporaryTotal
        (select count(cmpct.id) from com_mng_population_community_tags cmpct INNER JOIN com_mng_population cmp on cmpct.population_id = cmp.id where cmpct.community_id = ${communityId} and cmp.person_type = 1) AS houseRegTotal,
        (select count(cmpct.id) from com_mng_population_community_tags cmpct INNER JOIN com_mng_population cmp on cmpct.population_id = cmp.id where cmpct.community_id = ${communityId} and cmp.person_type = 2) AS leftTotal,
        (select count(cmpct.id) from com_mng_population_community_tags cmpct INNER JOIN com_mng_population cmp on cmpct.population_id = cmp.id where cmpct.community_id = ${communityId} and cmp.person_type = 3) AS outOfTownTotal,
        (select count(cmpct.id) from com_mng_population_community_tags cmpct INNER JOIN com_mng_population cmp on cmpct.population_id = cmp.id where cmpct.community_id = ${communityId} and cmp.person_type = 4) AS overseasTotal,
        (select count(cmpct.id) from com_mng_population_community_tags cmpct INNER JOIN com_mng_population cmp on cmpct.population_id = cmp.id where cmpct.community_id = ${communityId} and cmp.person_type = 5) AS floatingTotal,
        (select count(cmpct.id) from com_mng_population_community_tags cmpct INNER JOIN com_mng_population cmp on cmpct.population_id = cmp.id where cmpct.community_id = ${communityId} and cmp.person_type = 6) AS permanentTotal,
        (select count(cmpct.id) from com_mng_population_community_tags cmpct INNER JOIN com_mng_population cmp on cmpct.population_id = cmp.id where cmpct.community_id = ${communityId} and cmp.person_type = 7) AS temporaryTotal
        from com_mng_population_community_tags as cmpct inner join com_mng_population as cmp on cmp.id = cmpct.population_id where community_id = ${communityId}
    </select>
</mapper>
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/McsCouponMapper.xml
@@ -40,12 +40,12 @@
        SELECT
        (SELECT IF(SUM(coin) IS NULL,0,SUM(coin)) FROM mcs_coupon WHERE user_id = #{userId}) AS obtainedTotal,
        (SELECT COUNT(t1.id) FROM mcs_coupon t1 LEFT JOIN mcs_game t2 ON t1.game_id = t2.id WHERE t1.user_id = #{userId} AND t1.is_verified = 1 AND t2.type = 2) AS trialTotal,
        (SELECT COUNT(id) FROM mcs_coupon WHERE user_id = #{userId} AND is_verified = 1) AS joinGameTotal,
        (SELECT COUNT(t1.id) FROM mcs_coupon t1 LEFT JOIN mcs_game t2 ON t1.game_id = t2.id WHERE t1.user_id = #{userId} AND t1.is_verified = 1 AND t2.type = 1) AS joinGameTotal,
        (SELECT COUNT(id) FROM mcs_coupon WHERE user_id = #{userId} AND is_verified = 0) AS unVerifiedTotal
    </select>
    <select id="getCouponList"
            resultType="com.panzhihua.common.model.vos.community.microCommercialStreet.McsCouponVO">
        SELECT t1.*, t2.type, t2.`name`, t2.expire_at
        SELECT t1.*, t2.type, t2.award_type, t2.`name`, t2.expire_at
        FROM mcs_coupon t1
        LEFT JOIN mcs_game t2 ON t1.game_id = t2.id
        WHERE t1.user_id = #{userId}
@@ -74,10 +74,10 @@
        IF(ROUND((sendCouponTotal - unAppliedTotal - verifiedTotal)/(sendCouponTotal - unAppliedTotal) * 100,2) IS NULL,0,ROUND((sendCouponTotal - unAppliedTotal - verifiedTotal)/(sendCouponTotal - unAppliedTotal) * 100,2)) AS unVerifiedPercent
        FROM(
        SELECT
        (SELECT COUNT(t1.id) FROM mcs_game t1 LEFT JOIN mcs_merchant t2 ON t1.merchant_id = t2.id WHERE t1.`status` != 1 AND t1.is_del = 0 AND t2.user_id = #{userId}) AS gameTotal,
        (SELECT IF(SUM(coupons) IS NULL,0,SUM(coupons)) FROM mcs_game t1 LEFT JOIN mcs_merchant t2 ON t1.merchant_id = t2.id WHERE t1.`status` != 1 AND t1.is_del = 0 AND t2.user_id = #{userId}) AS sendCouponTotal,
        (SELECT IF(SUM(surplus_coupons) IS NULL,0,SUM(surplus_coupons)) FROM mcs_game t1 LEFT JOIN mcs_merchant t2 ON t1.merchant_id = t2.id WHERE t1.`status` != 1 AND t1.is_del = 0 AND t2.user_id = #{userId}) AS unAppliedTotal,
        (SELECT COUNT(t1.id) FROM mcs_verified_record t1 LEFT JOIN mcs_merchant t2 ON t1.merchant_id = t2.id LEFT JOIN mcs_game t3 ON t1.game_id = t3.id WHERE t3.is_del = 0 AND t2.user_id = #{userId}) AS verifiedTotal
        (SELECT COUNT(t1.id) FROM mcs_game t1 LEFT JOIN mcs_merchant t2 ON t1.merchant_id = t2.id WHERE t1.`status` != 1 AND t1.is_del = 0 AND t1.`type` = 1 AND t2.user_id = #{userId}) AS gameTotal,
        (SELECT IF(SUM(coupons) IS NULL,0,SUM(coupons)) FROM mcs_game t1 LEFT JOIN mcs_merchant t2 ON t1.merchant_id = t2.id WHERE t1.`status` != 1 AND t1.is_del = 0 AND t1.`type` = 1 AND t2.user_id = #{userId}) AS sendCouponTotal,
        (SELECT IF(SUM(surplus_coupons) IS NULL,0,SUM(surplus_coupons)) FROM mcs_game t1 LEFT JOIN mcs_merchant t2 ON t1.merchant_id = t2.id WHERE t1.`status` != 1 AND t1.is_del = 0 AND t1.`type` = 1 AND t2.user_id = #{userId}) AS unAppliedTotal,
        (SELECT COUNT(t1.id) FROM mcs_verified_record t1 LEFT JOIN mcs_merchant t2 ON t1.merchant_id = t2.id LEFT JOIN mcs_game t3 ON t1.game_id = t3.id WHERE t3.is_del = 0 AND t3.`type` = 1 AND t2.user_id = #{userId}) AS verifiedTotal
        ) temp
    </select>
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/McsGameMapper.xml
@@ -75,7 +75,7 @@
    <select id="pageMcsGame"
            resultType="com.panzhihua.common.model.vos.community.microCommercialStreet.McsGameVO">
        (SELECT t1.id, t1.`name`, t1.`type`, t1.coupons, t1.surplus_coupons,
        t1.publish_at, t1.`status`, t1.merchant_id, t2.`name` AS merchantName, t1.is_popular, t1.cover
        t1.publish_at, t1.expire_at, t1.`status`, t1.merchant_id, t2.`name` AS merchantName, t1.is_popular, t1.cover
        FROM mcs_game t1
        LEFT JOIN mcs_merchant t2 ON t1.merchant_id = t2.id
        WHERE t1.is_del = 0 AND t1.`status` = 2
@@ -94,7 +94,7 @@
        ORDER BY t1.created_at DESC LIMIT 99999)
        UNION ALL
        (SELECT t1.id, t1.`name`, t1.`type`, t1.coupons, t1.surplus_coupons,
        t1.publish_at, t1.`status`, t1.merchant_id, t2.`name` AS merchantName, t1.is_popular, t1.cover
        t1.publish_at, t1.expire_at, t1.`status`, t1.merchant_id, t2.`name` AS merchantName, t1.is_popular, t1.cover
        FROM mcs_game t1
        LEFT JOIN mcs_merchant t2 ON t1.merchant_id = t2.id
        WHERE t1.is_del = 0  AND t1.`status` != 2
@@ -141,23 +141,31 @@
    </select>
    <select id="pageH5McsGame"
            resultType="com.panzhihua.common.model.vos.community.microCommercialStreet.McsGameVO">
        SELECT t1.id, t1.`name`, t1.`type`, t1.coupons, t1.surplus_coupons, t1.award_type, t1.cover,
        t1.publish_at, t1.`status`, t1.merchant_id, t1.lat, t1.lon, t2.`name` AS merchantName
        FROM mcs_game t1
        LEFT JOIN mcs_merchant t2 ON t1.merchant_id = t2.id
        LEFT JOIN sys_user t3 ON t2.user_id = t3.user_id
        WHERE t1.is_del = 0 AND t1.`status` = 2 AND t1.expire_at > NOW() AND t3.`status` = 1
        <if test="pageMcsGameDTO.keyword != null and pageMcsGameDTO.keyword != &quot;&quot;">
            AND t1.`name` LIKE CONCAT(#{pageMcsGameDTO.keyword}, '%')
        SELECT * FROM (
            SELECT t1.id, t1.`name`, t1.`type`, t1.coupons, t1.surplus_coupons, t1.award_type, t1.cover,
            t1.publish_at, t1.`status`, t1.merchant_id, t1.lat, t1.lon, t2.`name` AS merchantName,
            ROUND(6378.138 * 2 * ASIN(SQRT(POW(SIN((t1.lat * PI() / 180 - #{pageMcsGameDTO.lat} * PI() / 180) / 2),2)
            +
            COS(t1.lat * PI() / 180) * COS(#{pageMcsGameDTO.lat} * PI() / 180) * POW(SIN((t1.lon * PI() / 180 -
            #{pageMcsGameDTO.lon} * PI() / 180) / 2),2))), 2) AS distance
            FROM mcs_game t1
            LEFT JOIN mcs_merchant t2 ON t1.merchant_id = t2.id
            LEFT JOIN sys_user t3 ON t2.user_id = t3.user_id
            WHERE t1.is_del = 0 AND t1.`status` = 2 AND t1.expire_at > NOW() AND t3.`status` = 1
            <if test="pageMcsGameDTO.keyword != null and pageMcsGameDTO.keyword != &quot;&quot;">
                AND t1.`name` LIKE CONCAT(#{pageMcsGameDTO.keyword}, '%')
            </if>
            <if test="pageMcsGameDTO.type != null">
                AND t1.`type` = #{pageMcsGameDTO.type}
            </if>
            <if test="pageMcsGameDTO.merchantId != null">
                AND t1.merchant_id = #{pageMcsGameDTO.merchantId}
            </if>
            ORDER BY t1.created_at DESC
        ) temp WHERE 1=1
        <if test="pageMcsGameDTO.distance != null">
            AND distance &lt;= #{pageMcsGameDTO.distance}
        </if>
        <if test="pageMcsGameDTO.merchantId != null">
            AND t1.merchant_id = #{pageMcsGameDTO.merchantId}
        </if>
        <if test="maxX != null">
            AND (t1.lon BETWEEN #{minX} AND #{maxX})
            AND (t1.lat BETWEEN #{minY} AND #{maxY})
        </if>
        ORDER BY t1.created_at DESC
    </select>
    <select id="selectDetailById"
            resultType="com.panzhihua.common.model.vos.community.microCommercialStreet.McsGameVO">
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/McsMerchantMapper.xml
@@ -116,12 +116,12 @@
            (SELECT COUNT(t1.id) FROM mcs_game t1
            LEFT JOIN mcs_merchant t2 ON t1.merchant_id = t2.id
            LEFT JOIN sys_user t3 ON t2.user_id = t3.user_id
            WHERE t1.is_del = 0 AND t1.`status` = 2 AND t1.expire_at &gt; NOW() AND t2.is_del = 0 AND t3.`status` = 1) AS gameTotal,
            WHERE t1.is_del = 0 AND t1.`status` = 2 AND t1.`type` = 1 AND t1.expire_at &gt; NOW() AND t2.is_del = 0 AND t3.`status` = 1) AS gameTotal,
            (SELECT COUNT(t1.id) FROM mcs_information t1
            (SELECT COUNT(t1.id) FROM mcs_game t1
            LEFT JOIN mcs_merchant t2 ON t1.merchant_id = t2.id
            LEFT JOIN sys_user t3 ON t2.user_id = t3.user_id
            WHERE t1.is_del = 0 AND t1.`status` = 2 AND t2.is_del = 0 AND t3.`status` = 1) AS infoTotal
            WHERE t1.is_del = 0 AND t1.`status` = 2 AND t1.`type` = 2 AND t1.expire_at &gt; NOW() AND t2.is_del = 0 AND t3.`status` = 1) AS infoTotal
        ) temp
    </select>
    <select id="pageH5McsMerchant"
springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/service/impl/UserServiceImpl.java
@@ -2869,12 +2869,8 @@
        } catch (Exception e) {
            e.printStackTrace();
            log.error("修改数字商业街商家用户报错【{}】", e.getMessage());
            if (e.getMessage().contains("union_phone_type")) {
                return R.fail("手机号已存在");
            } else if (e.getMessage().contains("union_account_type")) {
            if (e.getMessage().contains("union_account_type") || e.getMessage().contains("23000")) {
                return R.fail("账户已经存在");
            }else if(e.getMessage().contains("23000")){
                return R.fail("手机号已存在");
            } else {
                return R.fail("账户或手机号已存在,请重新填写尝试");
            }