| | |
| | | |
| | | 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.dtos.partybuilding.ComPbCheckUserDTO; |
| | | import com.panzhihua.common.model.vos.community.ComAreaTownCommunityVO; |
| | | import com.panzhihua.common.model.vos.community.acid.ComActAcidCheckRecordVO; |
| | | import com.panzhihua.common.model.vos.community.acid.ComActAcidMemberVO; |
| | |
| | | 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; |
| | | |
| | |
| | | } |
| | | } |
| | | 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); |
| | | } |
| | | 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); |
| | | } |
| | | loginUserInfoVO.setBackstageType(1); |
| | | String[] account={"dongqu","xiqu","yanbian","miyi","renhe","fantaixinqu"}; |
| | | if("zuzhibu".equals(sysUserDO.getAccount())){ |
| | | loginUserInfoVO.setBackstageType(2); |
| | | } |
| | | if(ArrayUtil.contains(account,sysUserDO.getAccount())){ |
| | | loginUserInfoVO.setBackstageType(3); |
| | | } |
| | | if(sysUserDO.getBindingCheckUnitId()!=null){ |
| | | loginUserInfoVO.setBackstageType(4); |
| | | } |
| | | return R.ok(loginUserInfoVO); |
| | | } |
| | |
| | | String encode = new BCryptPasswordEncoder().encode(storeVO.getStorePassword()); |
| | | BeanUtils.copyProperties(storeVO, sysUserDO); |
| | | sysUserDO.setAccount(storeVO.getStoreAccount()); |
| | | sysUserDO.setType(5); |
| | | sysUserDO.setType(20); |
| | | sysUserDO.setCommunityId(communityId); |
| | | sysUserDO.setAreaId(null); |
| | | sysUserDO.setStatus(1); |
| | | sysUserDO.setPhone(storeVO.getPhone()); |
| | | sysUserDO.setName(storeVO.getContacts()); |
| | | sysUserDO.setPassword(encode); |
| | | sysUserDO.setAppId("wx0cef797390444b75"); |
| | | try { |
| | | insert = userDao.insert(sysUserDO); |
| | | SysUserRoleDO sysUserRoleDO = new SysUserRoleDO(); |
| | | sysUserRoleDO.setUserId(sysUserDO.getUserId()); |
| | | sysUserRoleDO.setRoleId(sysRoleDO.getRoleId()); |
| | | sysUserRoleDAO.insert(sysUserRoleDO); |
| | | // 把SysUserId赋值给店铺 |
| | | if (sysUserDO.getUserId() != null) { |
| | | userDao.updateStoreByPhone(storeVO.getPhone(), sysUserDO.getUserId()); |
| | |
| | | } |
| | | 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 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 uuPush(String washPhone,String phone,String washName,Integer orderStatus) { |
| | | if(StringUtils.isNotEmpty(phone)){ |
| | | SysUserDO sysUserDO=userDao.selectOne(new QueryWrapper<SysUserDO>().lambda().eq(SysUserDO::getPhone,phone).orderByDesc(SysUserDO::getCreateAt).last("limit 1")); |
| | | SysUserDO sysUserDO=userDao.selectOne(new QueryWrapper<SysUserDO>().lambda().eq(SysUserDO::getPhone,phone).eq(SysUserDO::getAppId,"wx118de8a734d269f0").orderByDesc(SysUserDO::getCreateAt).last("limit 1")); |
| | | if(sysUserDO!=null&&StringUtils.isNotEmpty(sysUserDO.getOpenid())){ |
| | | String status=""; |
| | | String accessToken=""; |
| | |
| | | } |
| | | |
| | | @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 accept(Long userId) { |
| | | SysUserDO sysUserDO=new SysUserDO(); |
| | | sysUserDO.setUserId(userId); |
| | | sysUserDO.setIsAccept(1); |
| | | userDao.updateById(sysUserDO); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public R addComPbCheckUser(ComPbCheckUserDTO comPbCheckUserDTO) { |
| | | SysUserDO sysUserDO=userDao.selectOne(new QueryWrapper<SysUserDO>().lambda().eq(SysUserDO::getAccount,comPbCheckUserDTO.getAccount()).eq(SysUserDO::getType,3).eq(SysUserDO::getAppId,"wx118de8a734d269f0")); |
| | | if(sysUserDO!=null){ |
| | | return R.fail("账户名已存在"); |
| | | } |
| | | SysUserDO sysUserDO1=new SysUserDO(); |
| | | sysUserDO1.setUserId(Snowflake.getId()); |
| | | sysUserDO1.setAccount(comPbCheckUserDTO.getAccount()); |
| | | sysUserDO1.setPassword(new BCryptPasswordEncoder().encode(comPbCheckUserDTO.getPassword())); |
| | | sysUserDO1.setType(3); |
| | | sysUserDO1.setAppId("wx118de8a734d269f0"); |
| | | sysUserDO1.setCommunityId(0L); |
| | | sysUserDO1.setBindingCheckUnitId(comPbCheckUserDTO.getCheckUnitId()); |
| | | int restlt=userDao.insert(sysUserDO1); |
| | | if(restlt>0){ |
| | | SysUserRoleDO sysUserRoleDO=new SysUserRoleDO(); |
| | | sysUserRoleDO.setRoleId(123321L); |
| | | sysUserRoleDO.setUserId(sysUserDO1.getUserId()); |
| | | sysUserRoleDAO.insert(sysUserRoleDO); |
| | | } |
| | | 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.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)); |
| | | }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 getAreaAndStreet() { |