| | |
| | | |
| | | 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 com.panzhihua.common.model.vos.community.acid.ComActAcidRecordVO; |
| | | import com.panzhihua.common.model.vos.community.microCommercialStreet.McsLoginUserInfoVO; |
| | | import com.panzhihua.common.model.vos.user.*; |
| | | import com.panzhihua.common.service.community.CommunityService; |
| | | import com.panzhihua.common.utlis.*; |
| | | import com.panzhihua.service_user.dao.*; |
| | | import com.panzhihua.service_user.entity.SysAppConfig; |
| | |
| | | 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; |
| | | |
| | |
| | | private SysTemplateConfigDao sysTemplateConfigDao; |
| | | @Resource |
| | | private ObjectMapper objectMapper; |
| | | @Resource |
| | | private CommunityService communityService; |
| | | private static final Integer ALLCOUNTY=1; |
| | | private static final Integer ALLSTREET=2; |
| | | private static final Integer ALLCOMMUNITY=3; |
| | |
| | | } |
| | | } |
| | | loginUserInfoVO.setIsRealNamed(sysUserDO.getIdCard() != null); |
| | | //是否社区或街道后台 |
| | | int countSocialOrg=userDao.countSocialOrg(sysUserDO.getUserId()); |
| | | if(countSocialOrg>0){ |
| | | loginUserInfoVO.setUserType(3); |
| | | } |
| | | else { |
| | | if(loginUserInfoVO.getStreetId()!=null){ |
| | | loginUserInfoVO.setUserType(1); |
| | | loginUserInfoVO.setLevel(3); |
| | | } |
| | | else { |
| | | loginUserInfoVO.setUserType(2); |
| | | loginUserInfoVO.setLevel(4); |
| | | } |
| | | } |
| | | if (sysUserDO.getType().equals(11)){ |
| | | loginUserInfoVO.setLevel(5); |
| | | }else if (sysUserDO.getType().equals(12)){ |
| | | loginUserInfoVO.setLevel(2); |
| | | }else if (isNull(loginUserInfoVO.getLevel())){ |
| | | loginUserInfoVO.setLevel(1); |
| | | } |
| | | //是否为三说会堂专家 |
| | | R expert = communityService.isExpert(loginUserInfoVO.getPhone()); |
| | | if (R.isOk(expert)){ |
| | | loginUserInfoVO.setType(13); |
| | | } |
| | | return R.ok(loginUserInfoVO); |
| | | } |
| | | |
| | |
| | | else { |
| | | if(loginUserInfoVO.getStreetId()!=null){ |
| | | loginUserInfoVO.setUserType(1); |
| | | loginUserInfoVO.setLevel(3); |
| | | } |
| | | else { |
| | | loginUserInfoVO.setUserType(2); |
| | | loginUserInfoVO.setLevel(4); |
| | | } |
| | | } |
| | | if (sysUserDO.getType().equals(11)){ |
| | | loginUserInfoVO.setLevel(5); |
| | | }else if (sysUserDO.getType().equals(12)){ |
| | | loginUserInfoVO.setLevel(2); |
| | | }else if (isNull(loginUserInfoVO.getLevel())){ |
| | | loginUserInfoVO.setLevel(1); |
| | | } |
| | | return R.ok(loginUserInfoVO); |
| | | } |
| | |
| | | } |
| | | |
| | | @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()); |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | public R resetPassword(Integer type, String account) { |
| | | SysUserDO sysUserDO=userDao.selectOne(new QueryWrapper<SysUserDO>().lambda().eq(SysUserDO::getAccount,account).eq(SysUserDO::getType,type)); |
| | | public R resetPassword(Integer type, String account,String appId) { |
| | | SysUserDO sysUserDO=userDao.selectOne(new QueryWrapper<SysUserDO>().lambda().eq(SysUserDO::getAccount,account).eq(SysUserDO::getType,type).eq(SysUserDO::getAppId,appId)); |
| | | if(sysUserDO!=null){ |
| | | sysUserDO.setPassword("$2a$10$F/2lE2NMhKNHJfi5.FLmfu7jIr7ImRWgCTTeO6m3IRNR2V4sv8YR."); |
| | | userDao.updateById(sysUserDO); |
| | |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 三说会堂新增业务中心或专家账号 |
| | | * */ |
| | | @Override |
| | | public R addExpertOrIndustryCenter(AdministratorsUserVO administratorsUserVO) { |
| | | SysUserDO sysUserDO=new SysUserDO(); |
| | | //是否存在相同账号 |
| | | SysUserDO userDO = userDao.selectOne(new QueryWrapper<SysUserDO>().eq("account", administratorsUserVO.getAccount())); |
| | | if (isNull(userDO)){ |
| | | sysUserDO.setAppId("wx0cef797390444b75"); |
| | | sysUserDO.setCreateAt(new Date()); |
| | | sysUserDO.setUserId(administratorsUserVO.getUserId()); |
| | | sysUserDO.setAccount(administratorsUserVO.getAccount()); |
| | | sysUserDO.setPassword(new BCryptPasswordEncoder().encode(administratorsUserVO.getPassword())); |
| | | sysUserDO.setName(administratorsUserVO.getName()); |
| | | if (nonNull(administratorsUserVO.getImageUrl())){ |
| | | sysUserDO.setImageUrl(administratorsUserVO.getImageUrl()); |
| | | } |
| | | if (nonNull(administratorsUserVO.getType())){ |
| | | sysUserDO.setType(administratorsUserVO.getType()); |
| | | } |
| | | userDao.insert(sysUserDO); |
| | | //分配权限 |
| | | SysUserRoleDO sysUserRole=new SysUserRoleDO(); |
| | | sysUserRole.setUserId(sysUserDO.getUserId()); |
| | | if (sysUserDO.getType().equals(11)){ |
| | | sysUserRole.setRoleId(Long.parseLong(UserConstants.SANSHUO_EXPERT_ROLE)); |
| | | //将专家小程序账号设置为专家权限 |
| | | SysUserDO sysUserDO1 = userDao.selectOne(new QueryWrapper<SysUserDO>().lambda().eq(SysUserDO::getType, 1).eq(SysUserDO::getPhone, administratorsUserVO.getPhone())); |
| | | if (nonNull(sysUserDO1)){ |
| | | sysUserDO1.setType(13); |
| | | userDao.updateById(sysUserDO1); |
| | | log.info("添加专家小程序账号权限"); |
| | | } |
| | | }else{ |
| | | sysUserRole.setRoleId(Long.parseLong(UserConstants.SANSHUO_INDUSTRY_CENTER_ROLE)); |
| | | } |
| | | //配置权限 |
| | | sysUserRoleDAO.insert(sysUserRole); |
| | | return R.ok(); |
| | | } |
| | | return R.fail("账户名已存在"); |
| | | } |
| | | |
| | | /** |
| | | * 三说会堂后台重置密码 |
| | | * */ |
| | | @Override |
| | | public R resetPassExpertOrIndustryCenter(String account,String password) { |
| | | SysUserDO sysUserDO = userDao.selectOne(new QueryWrapper<SysUserDO>().eq("account", account)); |
| | | if (nonNull(sysUserDO)){ |
| | | sysUserDO.setPassword(new BCryptPasswordEncoder().encode(password)); |
| | | userDao.updateById(sysUserDO); |
| | | return R.ok(); |
| | | } |
| | | return R.fail("修改失败"); |
| | | } |
| | | |
| | | /** |
| | | * 移除专家权限 |
| | | * */ |
| | | @Override |
| | | public R removeExpertRole(String phone) { |
| | | if (nonNull(phone)){ |
| | | //是否有权限为专家的账号 |
| | | SysUserDO sysUserDO = userDao.selectOne(new QueryWrapper<SysUserDO>().lambda().eq(SysUserDO::getType, 11).eq(SysUserDO::getPhone, phone)); |
| | | if (nonNull(sysUserDO)){ |
| | | //删除后台账号 |
| | | sysUserDO.setStatus(2); |
| | | userDao.updateById(sysUserDO); |
| | | log.info("禁用专家后台账号成功"); |
| | | } |
| | | //小程序账号移除专家权限 |
| | | SysUserDO sysUserDO1 = userDao.selectOne(new QueryWrapper<SysUserDO>().lambda().eq(SysUserDO::getType, 13).eq(SysUserDO::getPhone, phone)); |
| | | if (nonNull(sysUserDO1)){ |
| | | sysUserDO1.setType(1); |
| | | userDao.updateById(sysUserDO1); |
| | | log.info("移除专家权限成功"); |
| | | } |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public R getAreaAndStreet() { |