| | |
| | | |
| | | import static java.util.Objects.isNull; |
| | | import static java.util.Objects.nonNull; |
| | | import static org.apache.commons.lang3.StringUtils.capitalize; |
| | | import static org.apache.commons.lang3.StringUtils.isNotBlank; |
| | | |
| | | import java.math.BigDecimal; |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import cn.hutool.core.collection.CollectionUtil; |
| | | import cn.hutool.core.collection.ListUtil; |
| | | import cn.hutool.core.date.DateTime; |
| | | import cn.hutool.core.date.DateUnit; |
| | | import cn.hutool.core.date.DateUtil; |
| | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.fasterxml.jackson.core.JsonProcessingException; |
| | | import com.fasterxml.jackson.databind.JsonNode; |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import com.panzhihua.common.model.dtos.community.microCommercialStreet.BindUserPhoneDTO; |
| | | import com.panzhihua.common.model.vos.community.ComAreaTownCommunityVO; |
| | |
| | | import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.util.ObjectUtils; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | |
| | | import com.panzhihua.service_user.model.dos.SysUserAgreementDO; |
| | | import com.panzhihua.service_user.model.dos.SysUserDO; |
| | | import com.panzhihua.service_user.model.dos.SysUserFeedbackDO; |
| | | import com.panzhihua.service_user.model.dos.SysUserInputDO; |
| | | import com.panzhihua.service_user.model.dos.SysUserNoticeDO; |
| | | import com.panzhihua.service_user.model.dos.SysUserRoleDO; |
| | | import com.panzhihua.service_user.model.dtos.DataKanbanDTO; |
| | |
| | | |
| | | import cn.hutool.core.util.IdcardUtil; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | |
| | | // import com.panzhihua.common.service.grid.GridService; |
| | | |
| | |
| | | * @return token |
| | | */ |
| | | @Override |
| | | public R updateInsertUser(String openid, String sessionKey, String unionid) { |
| | | public R updateInsertUser(String openid, String sessionKey, String unionid,String appId) { |
| | | SysUserDO sysUserDO = |
| | | userDao.selectOne(new QueryWrapper<SysUserDO>().lambda().eq(SysUserDO::getOpenid, openid)); |
| | | boolean empty = ObjectUtils.isEmpty(sysUserDO); |
| | |
| | | sysUserDO1.setLastLoginTime(date); |
| | | sysUserDO1.setPassword(encode); |
| | | sysUserDO1.setType(1); |
| | | sysUserDO1.setAppId(appId); |
| | | num = userDao.insert(sysUserDO1); |
| | | } else { |
| | | String encode = new BCryptPasswordEncoder().encode(UserConstants.PASSWORD); |
| | |
| | | sysUserDO.setPassword(encode); |
| | | sysUserDO.setLastLoginTime(date); |
| | | sysUserDO.setType(1); |
| | | sysUserDO.setAppId(appId); |
| | | num = userDao.updateById(sysUserDO); |
| | | } |
| | | if (num > 0) { |
| | |
| | | String encode = new BCryptPasswordEncoder().encode(administratorsUserVO.getPassword()); |
| | | administratorsUserVO.setPassword(encode); |
| | | BeanUtils.copyProperties(administratorsUserVO, sysUserDO); |
| | | sysUserDO.setAppId(administratorsUserVO.getAppid()); |
| | | int insert = 0; |
| | | try { |
| | | insert = userDao.insert(sysUserDO); |
| | |
| | | */ |
| | | @Override |
| | | public R dataKanBans(DataKanBansDto dataKanBansDto){ |
| | | IndexDataKanbanVO indexDataKanbanVO = userDao.selectIndexDataKanban(dataKanBansDto.getAreaCode()); |
| | | IndexDataKanbanVO indexDataKanbanVO = userDao.selectIndexDataKanban(dataKanBansDto.getAppId()); |
| | | List<String> communityUserX = new ArrayList<>(); |
| | | List<Integer> communityUserY = new ArrayList<>(); |
| | | |
| | |
| | | page.setSize(20L); |
| | | } |
| | | if(dataKanBansDto.getType() != null && dataKanBansDto.getType().equals(DataKanBansDto.type.by)){ |
| | | dataKanbanDTOS = userDao.selectCommunityUserOrderMonth(page, dataKanBansDto.getAreaCode()).getRecords(); |
| | | dataKanbanDTOS = userDao.selectCommunityUserOrderMonth(page, dataKanBansDto.getAppId()).getRecords(); |
| | | }else{ |
| | | dataKanbanDTOS = userDao.selectCommunityUserOrder(page, dataKanBansDto.getAreaCode()).getRecords(); |
| | | dataKanbanDTOS = userDao.selectCommunityUserOrder(page, dataKanBansDto.getAppId()).getRecords(); |
| | | } |
| | | if (!ObjectUtils.isEmpty(dataKanbanDTOS)) { |
| | | dataKanbanDTOS.forEach(dataKanbanDTO -> { |
| | |
| | | List<Date> serverndays = com.panzhihua.common.utlis.DateUtils.getOldDays(); |
| | | serverndays.forEach(date -> { |
| | | // 查询社区活动数量 |
| | | DataKanbanDTO dataKanbanDTO = userDao.selectCommunityAddUserOrder(dataKanBansDto.getAreaCode(),date); |
| | | DataKanbanDTO dataKanbanDTO = userDao.selectCommunityAddUserOrder(dataKanBansDto.getAppId(),date); |
| | | communityActiveUserX.add(DateFormatUtils.format(date, "MM-dd")); |
| | | communityActiveUserY.add(dataKanbanDTO.getNum()); |
| | | communityActiveUserZ.add(dataKanbanDTO.getDayNum()); |
| | |
| | | } |
| | | Map<String, String> headerMap=new HashMap<>(); |
| | | headerMap.put("appid","10000"); |
| | | String resultJson=HttpClientUtil.get("https://api.uucsh.cn/member/wx/get-access?province="+uuLoginVO.getProvince()+"&city="+uuLoginVO.getCity()+"&area="+uuLoginVO.getArea()+"&appid=10000×tamp="+uuLoginVO.getTimestamp()+"&sign="+uuLoginVO.getSign()+"&mobile="+uuLoginVO.getMobile(),headerMap,null); |
| | | String resultJson=HttpClientUtil.get("https://api.uucsh.cn/member/wx/get-access?province="+uuLoginVO.getProvince()+"&city="+uuLoginVO.getCity()+"&area="+uuLoginVO.getArea()+"&appid=10000×tamp="+uuLoginVO.getTimestamp()+"&sign="+uuLoginVO.getSign()+"&mobile="+uuLoginVO.getMobile()+"&couponId="+uuLoginVO.getCouponId(),headerMap,null); |
| | | JSONObject result = JSON.parseObject(resultJson); |
| | | if(result.get("status").equals(1)){ |
| | | return R.ok(result.get("data")); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public R newIndexData(Integer type, Long streetId,Long areaCode) { |
| | | IndexDataKanbanVO indexDataKanbanVO = userDao.selectIndexDataKanban(null); |
| | | public R newIndexData(Integer type, Long streetId,Long areaCode,String appId) { |
| | | IndexDataKanbanVO indexDataKanbanVO = userDao.selectIndexDataKanban(appId); |
| | | IndexDataAnalysisVO vo=new IndexDataAnalysisVO(); |
| | | if (ObjectUtils.isEmpty(type)){ |
| | | //不传默认为所有区县 |
| | |
| | | } |
| | | |
| | | @Override |
| | | public R userRate(Integer type, Long streetId, Long areaCode, Integer range) { |
| | | public R userRate(Integer type, Long streetId, Long areaCode, Integer range,String appId) { |
| | | IndexDataAnalysisVO analysisVO=new IndexDataAnalysisVO(); |
| | | if (type.equals(BYSTREET) || type.equals(BYAREA)){ |
| | | //街道,区县筛选 |
| | |
| | | BeanUtils.copyProperties(indexDataVO,analysisVO ); |
| | | }else { |
| | | //总量数据 |
| | | IndexDataKanbanVO indexDataKanbanVO = userDao.selectIndexDataKanban(null); |
| | | IndexDataKanbanVO indexDataKanbanVO = userDao.selectIndexDataKanban(appId); |
| | | BeanUtils.copyProperties(indexDataKanbanVO,analysisVO ); |
| | | } |
| | | String date=""; |
| | |
| | | date = DateUtil.parse(dateTime.toString(), "yyyy-MM-dd HH:mm:ss").toString(); |
| | | } |
| | | } |
| | | List<UserProportion> userProportions = userDao.userAnalysis(type, date, streetId,areaCode); |
| | | List<UserProportion> userProportions = userDao.userAnalysis(type, date, streetId,areaCode,appId); |
| | | List<UserRateAnalysisVO> userRateAnalysisVOList=new ArrayList<>(); |
| | | Boolean monthRange=false; |
| | | if (org.apache.commons.lang3.ObjectUtils.isNotEmpty(range)){ |
| | |
| | | } |
| | | //获取本月的用户总数作为计算占比的用户总数 |
| | | //IndexDataKanbanVO data = userDao.dataKanBanStreet(streetId, areaCode, date); |
| | | Integer monthUsers = userDao.getMonthUsers(streetId, areaCode, date); |
| | | Integer monthUsers = userDao.getMonthUsers(streetId, areaCode, date,appId); |
| | | vo.setRate(getRate(monthUsers,userProportion.getUser())); |
| | | }else{ |
| | | vo.setRate(getRate(analysisVO.getAllUser(),userProportion.getUser())); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public R realUser(Integer type, Long streetId, Long areaCode, Integer range) { |
| | | public R realUser(Integer type, Long streetId, Long areaCode, Integer range,String appId) { |
| | | IndexDataAnalysisVO analysisVO=new IndexDataAnalysisVO(); |
| | | if (type.equals(BYSTREET) || type.equals(BYAREA)){ |
| | | //街道,区县筛选 |
| | |
| | | BeanUtils.copyProperties(indexDataVO,analysisVO ); |
| | | }else { |
| | | //总量数据 |
| | | IndexDataKanbanVO indexDataKanbanVO = userDao.selectIndexDataKanban(null); |
| | | IndexDataKanbanVO indexDataKanbanVO = userDao.selectIndexDataKanban(appId); |
| | | BeanUtils.copyProperties(indexDataKanbanVO,analysisVO ); |
| | | } |
| | | String date=""; |
| | |
| | | } |
| | | } |
| | | RealUserVO realUserVO=new RealUserVO(); |
| | | List<RealUser> realUsers = userDao.realUserCount(type, date, streetId, areaCode); |
| | | List<RealUser> realUsers = userDao.realUserCount(type, date, streetId, areaCode,appId); |
| | | List<RealUserAnalysisVO> realUserList=new ArrayList<>(); |
| | | realUserVO.setRealUserCount(getStreetRealUser(realUsers)); |
| | | Integer rate = getRate(analysisVO.getAllUser(), realUserVO.getRealUserCount()); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public R userActivity(Integer type, Long streetId, Long areaCode, Integer range) { |
| | | public R userActivity(Integer type, Long streetId, Long areaCode, Integer range, String appId) { |
| | | UserActivityAnalysisVO vo=new UserActivityAnalysisVO(); |
| | | List<Date> activeX=getTwentyDays(); |
| | | List<String> activeY=new ArrayList<>(); |
| | |
| | | } |
| | | SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd"); |
| | | for (Date date : activeX) { |
| | | Map<String, Long> map = userDao.getDailyAddAndActive(DateUtil.parse(sdf.format(date)), streetId,areaCode); |
| | | Map<String, Long> map = userDao.getDailyAddAndActive(DateUtil.parse(sdf.format(date)), streetId,areaCode, appId); |
| | | adY.add(map.get("addUser").toString()); |
| | | activeY.add(map.get("activeUser").toString()); |
| | | } |