| | |
| | | package com.panzhihua.applets.api; |
| | | |
| | | import cn.binarywang.wx.miniapp.api.WxMaSecCheckService; |
| | | import com.netflix.discovery.converters.Auto; |
| | | import com.panzhihua.applets.config.WxMaConfiguration; |
| | | import com.panzhihua.common.constants.FtpConstants; |
| | | import com.panzhihua.common.constants.UserConstants; |
| | | import com.panzhihua.common.model.vos.R; |
| | | import com.panzhihua.common.model.vos.area.AreaInfoVo; |
| | | import com.panzhihua.common.model.vos.user.UserPhoneVO; |
| | | import com.panzhihua.common.service.community.CommunityService; |
| | | import com.panzhihua.common.service.user.UserService; |
| | | import com.panzhihua.common.utlis.SFTPUtil; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | |
| | | import java.io.File; |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | import java.util.Arrays; |
| | | import java.util.Base64; |
| | | import java.util.List; |
| | | import java.util.UUID; |
| | | import java.util.concurrent.TimeUnit; |
| | | import java.util.concurrent.atomic.AtomicBoolean; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | |
| | | @Value("${ftp.url}") |
| | | private String url; |
| | | |
| | | /** |
| | | * 允许的图片文件后缀 |
| | | */ |
| | | private static List<String> fileExtensionAllow = Arrays.asList("gif", "jpg", "png", "jpeg"); |
| | | /** |
| | | * 允许的视频文件后缀 |
| | | */ |
| | | private static List<String> videoExtensionAllow = Arrays.asList("mp4", "mov"); |
| | | |
| | | @Resource |
| | | private WxMaConfiguration wxMaConfiguration; |
| | | @Resource |
| | | private CommunityService communityService; |
| | | |
| | | @ApiOperation(value = "上传照片") |
| | | @ApiOperation(value = "上传照片/视频 (jpg/jpeg/png/mp4/mov)") |
| | | @PostMapping(value = "uploadimage", consumes = "multipart/*", headers = "content-type=multipart/form-date") |
| | | public R uploadImage(@RequestParam MultipartFile file, HttpServletRequest request) throws IOException { |
| | | // 微信图片内容校验 |
| | | WxMaSecCheckService wxMaSecCheckService = wxMaConfiguration.getMaService().getSecCheckService(); |
| | | String property = System.getProperty("user.dir"); |
| | | String fileName = property + File.separator + UUID.randomUUID().toString().replace("-", "") + ".jpg"; |
| | | |
| | | String fileExtension = ".jpg"; |
| | | |
| | | String originName = file.getOriginalFilename(); |
| | | AtomicBoolean isVideo = new AtomicBoolean(false); |
| | | videoExtensionAllow.forEach(ext ->{ |
| | | String originNameLowerCase = originName.toLowerCase(); |
| | | if(originNameLowerCase.endsWith("." +ext)){ |
| | | isVideo.set(true); |
| | | } |
| | | }); |
| | | if(isVideo.get()){ |
| | | fileExtension = ".mp4"; |
| | | } |
| | | |
| | | |
| | | String fileName = property + File.separator + UUID.randomUUID().toString().replace("-", "") + fileExtension; |
| | | File file1 = new File(fileName); |
| | | |
| | | String name = file.getOriginalFilename(); |
| | | name = UUID.randomUUID().toString().replaceAll("-", "") + ".jpg"; |
| | | name = UUID.randomUUID().toString().replaceAll("-", "") + fileExtension; |
| | | try { |
| | | SFTPUtil sftp = new SFTPUtil(userName, password, host, port); |
| | | sftp.login(); |
| | |
| | | |
| | | @ApiOperation(value = "车辆登记") |
| | | @PostMapping("car/register") |
| | | public R addComMngCar(@RequestBody ComMngCarAppletDTO comMngCarAppletDTO) { |
| | | public R addComMngCar(@Validated(AddGroup.class) @RequestBody ComMngCarAppletDTO comMngCarAppletDTO) { |
| | | LoginUserInfoVO loginUserInfo = this.getLoginUserInfo(); |
| | | Long communityId = loginUserInfo.getCommunityId(); |
| | | if (null!=communityId && 0!=communityId) { |
| | |
| | | pageQuestnaireDTO.setForParty(1 == isPartymember.intValue()); |
| | | pageQuestnaireDTO.setForVolunteer(1 == isVolunteer.intValue()); |
| | | pageQuestnaireDTO.setUserId(loginUserInfo.getUserId()); |
| | | // pageQuestnaireDTO.setState(0); |
| | | return communityService.pageQuestnaire(pageQuestnaireDTO, loginUserInfo.getCommunityId()); |
| | | } |
| | | |
| | | @ApiOperation(value = "分页查询社区调查问卷", response = QuestnaireListVo.class) |
| | | @PostMapping("/pageVolunteer") |
| | | public R pageVolunteer(@RequestBody PageQuestnaireDTO pageQuestnaireDTO) { |
| | | LoginUserInfoVO loginUserInfo = this.getLoginUserInfo(); |
| | | pageQuestnaireDTO.setForMasses(null); |
| | | pageQuestnaireDTO.setForVolunteer(true); |
| | | pageQuestnaireDTO.setForParty(true); |
| | | return communityService.pageQuestnaire(pageQuestnaireDTO, loginUserInfo.getCommunityId()); |
| | | return communityService.pageQuestnaire(pageQuestnaireDTO, getLoginUserInfo().getCommunityId()); |
| | | } |
| | | |
| | | @ApiOperation(value = "创建调查问卷") |
| | |
| | | @ApiOperation(value = "社区所有启用的党组织列表", response = PartyOrganizationVO.class) |
| | | @PostMapping("listpartyorganization") |
| | | public R listPartyOrganization(@RequestBody ComListPartyDTO comListPartyDTO) { |
| | | Long communityId = this.getCommunityId(); |
| | | log.info("社区所有党组织社区id【{}】", communityId); |
| | | if(communityId != null){ |
| | | comListPartyDTO.setCommunityId(communityId); |
| | | } |
| | | // Long communityId = this.getCommunityId(); |
| | | // log.info("社区所有党组织社区id【{}】", communityId); |
| | | // if(communityId != null){ |
| | | // comListPartyDTO.setCommunityId(communityId); |
| | | // } |
| | | return partyBuildingService.listPartyOrganizationByApp(comListPartyDTO); |
| | | } |
| | | |
| | |
| | | package com.panzhihua.applets.api; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.panzhihua.applets.config.WxMaProperties; |
| | | import com.panzhihua.common.controller.BaseController; |
| | | import com.panzhihua.common.model.dtos.shop.*; |
| | |
| | | @ApiOperation(value = "分页查询店铺" , response = PageShopStoreVO.class) |
| | | @PostMapping("pageshopstore") |
| | | public R pageShopStore(@RequestBody PageComShopStoreDTO comShopStoreDTO) { |
| | | PageComShopSysConfDTO pageComShopSysConfDTO = new PageComShopSysConfDTO(); |
| | | R conf = communityService.pageShopSysConf(pageComShopSysConfDTO); |
| | | if(R.isOk(conf)&& conf.getData()!=null){ |
| | | ComShopSysConfVO comShopSysConfVO = JSONObject.parseObject(JSONObject.toJSONString(conf.getData()), ComShopSysConfVO.class); |
| | | if("1".equals(comShopSysConfVO.getVal()) && "1".equals(comShopSysConfVO.getEnabled())){ |
| | | return R.ok(); |
| | | } |
| | | } |
| | | return communityService.pageShopStore(comShopStoreDTO); |
| | | } |
| | | |
| | |
| | | if(userId == null){ |
| | | return R.fail("请重新登陆"); |
| | | } |
| | | PageComShopSysConfDTO pageComShopSysConfDTO = new PageComShopSysConfDTO(); |
| | | R conf = communityService.pageShopSysConf(pageComShopSysConfDTO); |
| | | if(R.isOk(conf)&& conf.getData()!=null){ |
| | | ComShopSysConfVO comShopSysConfVO = JSONObject.parseObject(JSONObject.toJSONString(conf.getData()), ComShopSysConfVO.class); |
| | | if("1".equals(comShopSysConfVO.getVal()) && "1".equals(comShopSysConfVO.getEnabled())){ |
| | | return R.ok(0); |
| | | } |
| | | } |
| | | return communityService.shopCartUserTotal(userId); |
| | | } |
| | | |
| | |
| | | import com.panzhihua.applets.model.dtos.ComPbMemberCertificationDTO; |
| | | import com.panzhihua.common.constants.UserConstants; |
| | | import com.panzhihua.common.model.dtos.shop.ExcelShopOrderDTO; |
| | | import com.panzhihua.common.constants.SecurityConstants; |
| | | import com.panzhihua.common.constants.UserConstants; |
| | | import com.panzhihua.common.model.dtos.user.SysUserEditTipsDTO; |
| | | import com.panzhihua.common.model.dtos.user.SysUserFeedbackDTO; |
| | | import com.panzhihua.common.model.vos.community.*; |
| | |
| | | private PartyBuildingService partyBuildingService; |
| | | @Resource |
| | | private CheckService checkService; |
| | | @Resource |
| | | private StringRedisTemplate stringRedisTemplate; |
| | | |
| | | @ApiOperation(value = "当前登录用户信息", response = LoginUserInfoVO.class) |
| | | @GetMapping("info") |
| | |
| | | if (R.isOk(r1)) { |
| | | log.info("新增实名认证未通过通知成功【{}】", JSONObject.toJSONString(sysUserNoticeVO)); |
| | | } |
| | | //清空缓存 |
| | | String userRoleKey = UserConstants.LOGIN_USER_INFO + this.getLoginUserInfo().getUserId(); |
| | | String userAppletRoleKey = SecurityConstants.ROLE_APPLETS_USER + this.getLoginUserInfo().getUserId(); |
| | | stringRedisTemplate.delete(userRoleKey); |
| | | stringRedisTemplate.delete(userAppletRoleKey); |
| | | } else { |
| | | //未通过发通知 |
| | | /** |
| | |
| | | InputStream inputStream = null; |
| | | try { |
| | | inputStream = file.getInputStream(); |
| | | EasyExcel.read(inputStream, ComCvtServeExcelVO.class, new ComCvtServeExcelListen(communityService,null)).sheet().doRead(); |
| | | EasyExcel.read(inputStream, ComCvtServeExcelVO.class, new ComCvtServeExcelListen(communityService,null)) |
| | | .sheet().doRead(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | log.error("导入模板失败【{}】", e.getMessage()); |
| | | return R.fail(); |
| | | } |
| | | return R.ok(); |
| | | } |
| | |
| | | @ApiOperation(value = "保存商家") |
| | | @PostMapping("/store/save") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R saveStore(@Validated(AddGroup.class) @RequestBody ShopStoreVO storeVO) { |
| | | public R saveStore(@Validated @RequestBody ShopStoreVO storeVO) { |
| | | LoginUserInfoVO loginUserInfo = this.getLoginUserInfo(); |
| | | Long loginUserId = loginUserInfo.getUserId(); |
| | | if (storeVO == null) { |
| | |
| | | @ApiOperation(value = "编辑商家、启用、禁用") |
| | | @PostMapping("/store/edit/{id}") |
| | | @ApiImplicitParam(name = "id", value = "商家id") |
| | | public R editStore(@Validated(AddGroup.class) @RequestBody ShopStoreVO storeVO, @PathVariable("id") Long id) { |
| | | public R editStore(@Validated @RequestBody ShopStoreVO storeVO, @PathVariable("id") Long id) { |
| | | //判断参数 |
| | | if(storeVO == null || id == null){ |
| | | return R.fail("参数错误"); |
| | |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "配送完成") |
| | | @PutMapping("/order/finishDeliver") |
| | | public R finishDeliver(@RequestBody ComShopOrderDeliverDTO deliverDTO){ |
| | | deliverDTO.setOperUserAccount(getLoginUserInfo().getPhone()); |
| | | deliverDTO.setIsAdmin(true); |
| | | return communityService.finishDeliverOrder(deliverDTO); |
| | | @ApiOperation(value = "商家配置修改") |
| | | @PutMapping("/shop/conf") |
| | | public R editConf(@RequestBody ComShopSysConfDTO comShopSysConfDTO){ |
| | | return communityService.editShopSysConf(comShopSysConfDTO); |
| | | } |
| | | |
| | | @ApiOperation(value = "商家配置查询", response = ComShopHiddenConfVO.class) |
| | | @GetMapping("/shop/conf") |
| | | public R getConf(){ |
| | | PageComShopSysConfDTO pageComShopSysConfDTO = new PageComShopSysConfDTO(); |
| | | R r = communityService.pageShopSysConf(pageComShopSysConfDTO); |
| | | if(R.isOk(r) && r.getData()!=null){ |
| | | ComShopSysConfVO comShopSysConfVO = JSONObject.parseObject(JSONObject.toJSONString(r.getData()), ComShopSysConfVO.class); |
| | | if(comShopSysConfVO!=null){ |
| | | ComShopHiddenConfVO comShopHiddenConfVO = new ComShopHiddenConfVO(); |
| | | comShopHiddenConfVO.setId(comShopSysConfVO.getId()); |
| | | comShopHiddenConfVO.setHidden(comShopSysConfVO.getVal()); |
| | | return R.ok(comShopHiddenConfVO); |
| | | } |
| | | } |
| | | return r; |
| | | } |
| | | |
| | | } |
| | |
| | | public static final int CONFLICT = 409; |
| | | |
| | | /** |
| | | * 请求主体的大小超过了服务器 |
| | | */ |
| | | public static final int REQUEST_TOO_LARGE = 413; |
| | | |
| | | /** |
| | | * 不支持的数据,媒体类型 |
| | | */ |
| | | public static final int UNSUPPORTED_TYPE = 415; |
| | |
| | | public static final String APPLETS_ACCESS_MEDIA_ID ="APPLETS_ACCESS_MEDIA_ID";//小程序获取的access_token |
| | | public static final String APPLETS_ACCESS_MEDIA_ID_TIME ="APPLETS_ACCESS_MEDIA_ID_TIME";//小程序获取的access_token |
| | | |
| | | |
| | | public static final String ROLE_APPLETS_REAL_NAMED="applets:realnamed";//小程序用户实名角色 |
| | | public static final String ROLE_APPLETS_USER="applets:realnamed:user:";//小程序用户角色 |
| | | } |
New file |
| | |
| | | package com.panzhihua.common.enums; |
| | | |
| | | import lombok.Getter; |
| | | |
| | | /** |
| | | * 文化程度 |
| | | * |
| | | * @author huanghongfa |
| | | */ |
| | | @Getter |
| | | public enum PopulCultureLevelEnum |
| | | { |
| | | XX(1, "小学"), |
| | | CZ(2, "初中"), |
| | | GZ(3, "高中"), |
| | | ZZ(4, "中专"), |
| | | DZ(5, "大专"), |
| | | BK(6, "本科"), |
| | | SS(7, "硕士"), |
| | | BS(8, "博士"), |
| | | QT(9, "其他"); |
| | | |
| | | private final Integer code; |
| | | private final String name; |
| | | |
| | | PopulCultureLevelEnum(Integer code, String name) |
| | | { |
| | | this.code = code; |
| | | this.name = name; |
| | | } |
| | | |
| | | public static int getCodeByName(String name) { |
| | | for (PopulCultureLevelEnum item : PopulCultureLevelEnum.values()) { |
| | | if (item.name.equals(name)) { |
| | | return item.getCode(); |
| | | } |
| | | } |
| | | return 9; |
| | | } |
| | | |
| | | public static String getCnDescByName(Integer code) { |
| | | for (PopulCultureLevelEnum item : PopulCultureLevelEnum.values()) { |
| | | if (item.code.equals(code)) { |
| | | return item.getName(); |
| | | } |
| | | } |
| | | return "其他"; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.panzhihua.common.enums; |
| | | |
| | | import lombok.Getter; |
| | | |
| | | /** |
| | | * 婚姻状况 |
| | | * |
| | | * @author huanghongfa |
| | | */ |
| | | @Getter |
| | | public enum PopulMarriageEnum |
| | | { |
| | | WH(1, "未婚"), |
| | | YH(2, "已婚"), |
| | | LY(3, "离异"), |
| | | SO(4, "丧偶"), |
| | | FJ(5, "分居"), |
| | | QT(6, "其他"); |
| | | |
| | | private final Integer code; |
| | | private final String name; |
| | | |
| | | PopulMarriageEnum(Integer code, String name) |
| | | { |
| | | this.code = code; |
| | | this.name = name; |
| | | } |
| | | |
| | | public static int getCodeByName(String name) { |
| | | for (PopulMarriageEnum item : PopulMarriageEnum.values()) { |
| | | if (item.name.equals(name)) { |
| | | return item.getCode(); |
| | | } |
| | | } |
| | | return 6; |
| | | } |
| | | |
| | | public static String getCnDescByName(Integer code) { |
| | | for (PopulMarriageEnum item : PopulMarriageEnum.values()) { |
| | | if (item.code.equals(code)) { |
| | | return item.getName(); |
| | | } |
| | | } |
| | | return "其他"; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.panzhihua.common.enums; |
| | | |
| | | import lombok.Getter; |
| | | |
| | | /** |
| | | * 与户主关系 |
| | | * |
| | | * @author huanghongfa |
| | | */ |
| | | @Getter |
| | | public enum PopulRelationEnum |
| | | { |
| | | HZ(1, "户主"), |
| | | PO(2, "配偶"), |
| | | ZN(3, "子女"), |
| | | SN(4, "孙女"), |
| | | FM(5, "父母"), |
| | | QT(6, "其他"); |
| | | |
| | | private final Integer code; |
| | | private final String name; |
| | | |
| | | PopulRelationEnum(Integer code, String name) |
| | | { |
| | | this.code = code; |
| | | this.name = name; |
| | | } |
| | | |
| | | public static int getCodeByName(String name) { |
| | | for (PopulRelationEnum item : PopulRelationEnum.values()) { |
| | | if (item.name.equals(name)) { |
| | | return item.getCode(); |
| | | } |
| | | } |
| | | return 6; |
| | | } |
| | | |
| | | public static String getCnDescByName(Integer code) { |
| | | for (PopulRelationEnum item : PopulRelationEnum.values()) { |
| | | if (item.code.equals(code)) { |
| | | return item.getName(); |
| | | } |
| | | } |
| | | return "其他"; |
| | | } |
| | | |
| | | } |
| | |
| | | import com.alibaba.excel.context.AnalysisContext; |
| | | import com.alibaba.excel.event.AnalysisEventListener; |
| | | import com.google.common.collect.Lists; |
| | | import com.panzhihua.common.enums.PopulIsOkEnum; |
| | | import com.panzhihua.common.enums.PopulPoliticalOutlookEnum; |
| | | import com.panzhihua.common.enums.PopulSexEnum; |
| | | import com.panzhihua.common.enums.*; |
| | | import com.panzhihua.common.exceptions.ServiceException; |
| | | import com.panzhihua.common.model.vos.R; |
| | | import com.panzhihua.common.model.vos.community.ComMngPopulationServeExcelVO; |
| | | import com.panzhihua.common.service.community.CommunityService; |
| | | import com.panzhihua.common.utlis.AgeUtils; |
| | | import com.panzhihua.common.utlis.StringUtils; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | import java.util.ArrayList; |
| | |
| | | vo.setIsRent(PopulIsOkEnum.getCodeByName(oneData.get(4))); |
| | | } |
| | | if(oneData.get(5) != null){ |
| | | vo.setRelation(oneData.get(5)); |
| | | vo.setRelation(PopulRelationEnum.getCodeByName(oneData.get(5))); |
| | | } |
| | | if(oneData.get(6) != null){ |
| | | vo.setRoad(oneData.get(6)); |
| | |
| | | vo.setUnitNo(Integer.valueOf(oneData.get(9))); |
| | | } |
| | | if(oneData.get(10) != null){ |
| | | vo.setHouseNo(Integer.valueOf(oneData.get(10))); |
| | | vo.setHouseNo(Integer.valueOf(oneData.get(10).trim())); |
| | | } |
| | | if(oneData.get(11) != null){ |
| | | vo.setPhone(oneData.get(11)); |
| | |
| | | vo.setNativePlace(oneData.get(12)); |
| | | } |
| | | if(oneData.get(13) != null){ |
| | | vo.setCultureLevel(oneData.get(13)); |
| | | vo.setCultureLevel(PopulCultureLevelEnum.getCodeByName(oneData.get(13))); |
| | | } |
| | | if(oneData.get(14) != null){ |
| | | vo.setMarriage(oneData.get(14)); |
| | | vo.setMarriage(PopulMarriageEnum.getCodeByName(oneData.get(14))); |
| | | } |
| | | if(oneData.get(15) != null){ |
| | | vo.setHealthy(oneData.get(15)); |
| | |
| | | if(oneData.get(16) != null){ |
| | | vo.setWorkCompany(oneData.get(16)); |
| | | } |
| | | if(oneData.get(17) != null){ |
| | | vo.setRemark(oneData.get(17)); |
| | | |
| | | if(oneData.get(17) != null && StringUtils.isNotEmpty(oneData.get(17))){ |
| | | String outOrLocal = oneData.get(17); |
| | | if(outOrLocal.equals(ComMngPopulationServeExcelVO.outOrLocal.bd)){ |
| | | vo.setOutOrLocal(1); |
| | | }else if(outOrLocal.equals(ComMngPopulationServeExcelVO.outOrLocal.wd)){ |
| | | vo.setOutOrLocal(2); |
| | | } |
| | | for (int i = 18; i < headSize; i++) { |
| | | } |
| | | if(oneData.get(18) != null){ |
| | | vo.setCensusRegister(oneData.get(18)); |
| | | } |
| | | if(oneData.get(19) != null){ |
| | | vo.setRemark(oneData.get(19)); |
| | | } |
| | | for (int i = 20; i < headSize; i++) { |
| | | if (oneData.get(i) != null && oneData.get(i).equals("是")) { |
| | | vo.getUserTagStr().add(headData.get(i)); |
| | | vo.getUserTagStr().add(headData.get(i).substring(0,headData.get(i).indexOf("("))); |
| | | } |
| | | } |
| | | voList.add(vo); |
| | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.google.common.collect.Lists; |
| | | import com.panzhihua.common.enums.PopulIsOkEnum; |
| | | import com.panzhihua.common.enums.PopulPoliticalOutlookEnum; |
| | | import com.panzhihua.common.enums.PopulSexEnum; |
| | | import com.panzhihua.common.enums.*; |
| | | import com.panzhihua.common.exceptions.ServiceException; |
| | | import com.panzhihua.common.model.vos.R; |
| | | import com.panzhihua.common.model.vos.community.ComMngPopulationImportErrorVO; |
| | |
| | | vo.setIsRent(PopulIsOkEnum.getCodeByName(oneData.get(4))); |
| | | } |
| | | if(oneData.get(5) != null){ |
| | | vo.setRelation(oneData.get(5)); |
| | | vo.setRelation(PopulRelationEnum.getCodeByName(oneData.get(5))); |
| | | } |
| | | if(oneData.get(6) != null){ |
| | | vo.setRoad(oneData.get(6)); |
| | |
| | | vo.setUnitNo(Integer.valueOf(oneData.get(9))); |
| | | } |
| | | if(oneData.get(10) != null){ |
| | | vo.setHouseNo(Integer.valueOf(oneData.get(10))); |
| | | vo.setHouseNo(Integer.valueOf(oneData.get(10).trim())); |
| | | } |
| | | if(oneData.get(11) != null){ |
| | | vo.setPhone(oneData.get(11)); |
| | |
| | | vo.setNativePlace(oneData.get(12)); |
| | | } |
| | | if(oneData.get(13) != null){ |
| | | vo.setCultureLevel(oneData.get(13)); |
| | | vo.setCultureLevel(PopulCultureLevelEnum.getCodeByName(oneData.get(13))); |
| | | } |
| | | if(oneData.get(14) != null){ |
| | | vo.setMarriage(oneData.get(14)); |
| | | vo.setMarriage(PopulMarriageEnum.getCodeByName(oneData.get(14))); |
| | | } |
| | | if(oneData.get(15) != null){ |
| | | vo.setHealthy(oneData.get(15)); |
| | |
| | | if(oneData.get(16) != null){ |
| | | vo.setWorkCompany(oneData.get(16)); |
| | | } |
| | | if(oneData.get(17) != null){ |
| | | vo.setRemark(oneData.get(17)); |
| | | |
| | | if(oneData.get(17) != null && StringUtils.isNotEmpty(oneData.get(17))){ |
| | | String outOrLocal = oneData.get(17); |
| | | if(outOrLocal.equals(ComMngPopulationServeExcelVO.outOrLocal.bd)){ |
| | | vo.setOutOrLocal(1); |
| | | }else if(outOrLocal.equals(ComMngPopulationServeExcelVO.outOrLocal.wd)){ |
| | | vo.setOutOrLocal(2); |
| | | } |
| | | for (int i = 18; i < headSize; i++) { |
| | | } |
| | | if(oneData.get(18) != null){ |
| | | vo.setCensusRegister(oneData.get(18)); |
| | | } |
| | | if(oneData.get(19) != null){ |
| | | vo.setRemark(oneData.get(19)); |
| | | } |
| | | for (int i = 20; i < headSize; i++) { |
| | | if (oneData.get(i) != null && oneData.get(i).equals("是")) { |
| | | vo.getUserTagStr().add(headData.get(i).substring(0,headData.get(i).indexOf("("))); |
| | | } |
| | |
| | | import com.panzhihua.common.model.vos.community.ComMngRealCompanyExcelVO; |
| | | import com.panzhihua.common.service.community.CommunityService; |
| | | import com.panzhihua.common.utlis.ListUtils; |
| | | import com.panzhihua.common.utlis.StringUtils; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | import java.util.ArrayList; |
| | |
| | | } |
| | | |
| | | |
| | | private static final int BATCH_COUNT = 100; |
| | | private static final int BATCH_COUNT = 5000; |
| | | private List<ComMngRealCompanyExcelVO> list = new ArrayList<>(); |
| | | |
| | | @Override |
| | | public void invoke(ComMngRealCompanyExcelVO comMngRealCompanyExcelVO, AnalysisContext analysisContext) { |
| | | if(StringUtils.isEmpty(comMngRealCompanyExcelVO.getCreditCode())){ |
| | | throw new ServiceException("统一社会信用代码不可为空"); |
| | | } |
| | | list.add(comMngRealCompanyExcelVO); |
| | | // 达到BATCH_COUNT了,需要去存储一次数据库,防止数据几万条数据在内存,容易OOM |
| | | if(list.size() >= BATCH_COUNT){ |
| | |
| | | |
| | | @ApiModelProperty("商家名称") |
| | | @NotBlank(groups = {AddGroup.class},message = "商家名称不能为空") |
| | | @Length(groups = {AddGroup.class}, max = 35, message = "商家名称不能为空大于35个字") |
| | | private String name; |
| | | |
| | | @ApiModelProperty("联系人") |
| | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import org.hibernate.validator.constraints.Length; |
| | | |
| | | import javax.validation.constraints.NotBlank; |
| | | import java.io.Serializable; |
| | |
| | | |
| | | @ApiModelProperty(value = "车牌号") |
| | | @NotBlank(groups = {AddGroup.class},message = "车牌号不能为空") |
| | | @Length(groups = {AddGroup.class}, max = 20,message = "车牌号长度错误") |
| | | private String plateNum; |
| | | |
| | | @ApiModelProperty(value = "车辆品牌型号") |
| | | @NotBlank(groups = {AddGroup.class},message = "车辆品牌型号不能为空") |
| | | @Length(groups = {AddGroup.class}, max = 20,message = "车辆品牌型号超长") |
| | | private String brand; |
| | | |
| | | @ApiModelProperty(value = "车身颜色") |
| | |
| | | */ |
| | | @ApiModelProperty(value="年龄") |
| | | private Integer age; |
| | | |
| | | /** |
| | | * 身份证号码 |
| | | */ |
New file |
| | |
| | | package com.panzhihua.common.model.dtos.shop; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @ClasssName ComShopSysConfDTO |
| | | * @Description 商家配置信息 |
| | | * @Author cedoo |
| | | * @Date 2021/05/11 |
| | | * @Version 1.0 |
| | | **/ |
| | | @Data |
| | | @ApiModel("商家系统配置") |
| | | public class ComShopSysConfDTO { |
| | | @ApiModelProperty(value = "id", required = true) |
| | | private Long id; |
| | | @ApiModelProperty(value = "是否隐藏所有商家 0 否 1是", required = true) |
| | | private Integer hidden; |
| | | } |
New file |
| | |
| | | package com.panzhihua.common.model.dtos.shop; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @auther llming |
| | | * @describe 分页查询商品 |
| | | */ |
| | | @ApiModel("分页查询商品") |
| | | @Data |
| | | public class PageComShopSysConfDTO { |
| | | @ApiModelProperty(value = "分页-当前页数", example = "1", required = false) |
| | | private Long pageNum = 1l; |
| | | |
| | | @ApiModelProperty(value = "分页-每页记录数", example = "10", required = false) |
| | | private Long pageSize = 10l; |
| | | } |
| | |
| | | @ExcelProperty(value = "是否租住", index = 4) |
| | | private Integer isRent; |
| | | |
| | | @ExcelProperty(value = "与户主关系", index = 5) |
| | | private String relation; |
| | | @ExcelProperty(value = "与户主关系(1.户主 2.配偶 3.子女 4.孙女 5.父母 6.其他)", index = 5) |
| | | private Integer relation; |
| | | |
| | | @ExcelProperty(value = "街路巷", index = 6) |
| | | private String road; |
| | |
| | | @ExcelProperty(value = "籍贯", index = 12) |
| | | private String nativePlace; |
| | | |
| | | @ExcelProperty(value = "文化程度", index = 13) |
| | | private String cultureLevel; |
| | | @ExcelProperty(value = "文化程度(1.小学 2.初中 3.高中 4.中专 5.大专 6.本科 7.硕士 8.博士 9.其他)", index = 13) |
| | | private Integer cultureLevel; |
| | | |
| | | @ExcelProperty(value = "婚姻状况", index = 14) |
| | | private String marriage; |
| | | @ExcelProperty(value = "婚姻状况(1.未婚 2.已婚 3.离异 4.丧偶 5.分居 6.其他)", index = 14) |
| | | private Integer marriage; |
| | | |
| | | @ExcelProperty(value = "健康状况", index = 15) |
| | | private String healthy; |
| | |
| | | @ExcelProperty(value = "工作单位", index = 16) |
| | | private String workCompany; |
| | | |
| | | @ExcelProperty(value = "备注", index = 17) |
| | | @ExcelProperty(value = "外地or本地(1.本地 2.外地)", index = 17) |
| | | private Integer outOrLocal; |
| | | |
| | | @ExcelProperty(value = "户口所在地", index = 18) |
| | | private String censusRegister; |
| | | |
| | | @ExcelProperty(value = "备注", index = 19) |
| | | private String remark; |
| | | |
| | | private Integer age; |
| | |
| | | */ |
| | | private List<String> userTagStr = Lists.newArrayList(); |
| | | |
| | | /** |
| | | * 外地or本地(1.本地 2.外地) |
| | | */ |
| | | public interface outOrLocal{ |
| | | String bd = "本地"; |
| | | String wd = "外地"; |
| | | } |
| | | |
| | | } |
| | |
| | | @ApiModelProperty("身份证号码") |
| | | @NotBlank(groups = {AddGroup.class},message = "身份证号码不可为空") |
| | | @EncryptDecryptField |
| | | @Sensitive(strategy = SensitiveStrategy.ID_CARD) |
| | | private String cardNo; |
| | | |
| | | @ApiModelProperty("出生年月") |
| | | private String birthday; |
| | | |
| | | @ApiModelProperty("街路巷") |
| | | @NotBlank(groups = {AddGroup.class},message = "街路巷不可为空") |
| | |
| | | @ApiModelProperty("修改时间") |
| | | private Date updateAt; |
| | | |
| | | |
| | | @ApiModelProperty("籍贯") |
| | | private String nativePlace; |
| | | |
| | |
| | | @ApiModelProperty("小区名字") |
| | | private String alley; |
| | | |
| | | @ApiModelProperty("户主关系") |
| | | @ApiModelProperty("户主关系列表") |
| | | private List<ComHouseMemberVo> comMngFamilyInfoVOS; |
| | | |
| | | @ApiModelProperty("家庭成员信息") |
| | |
| | | @NotBlank(groups = {AddGroup.class},message = "是否租住不可为空") |
| | | private Integer isRent; |
| | | |
| | | @ApiModelProperty("文化程度(1.小学 2.初中 3.高中 4.中专 5.大专 6.本科 7.硕士 8.博士 9.其他)") |
| | | private Integer cultureLevel; |
| | | |
| | | @ApiModelProperty("文化程度") |
| | | private String cultureLevel; |
| | | |
| | | |
| | | @ApiModelProperty("婚姻状况") |
| | | private String marriage; |
| | | |
| | | @ApiModelProperty("婚姻状况(1.未婚 2.已婚 3.离异 4.丧偶 5.分居 6.其他)") |
| | | private Integer marriage; |
| | | |
| | | @ApiModelProperty("健康状况") |
| | | private String healthy; |
| | | |
| | | @ApiModelProperty("外地or本地(1.本地 2.外地)") |
| | | private Integer outOrLocal; |
| | | |
| | | @ApiModelProperty("户口所在地") |
| | | private String censusRegister; |
| | | |
| | | @ApiModelProperty("与户主关系(1.户主 2.配偶 3.子女 4.孙女 5.父母 6.其他)") |
| | | private Integer relation; |
| | | |
| | | public interface sex{ |
| | | int nan = 1; |
| | | int nv = 2; |
| | |
| | | * 实有人口Vo |
| | | */ |
| | | @Data |
| | | @ApiModel("实有人口表") |
| | | @ApiModel("实有人口编辑表") |
| | | @EncryptDecryptClass |
| | | public class EditComMngPopulationVO implements Serializable { |
| | | |
| | |
| | | @ApiModelProperty("小区名字") |
| | | private String alley; |
| | | |
| | | |
| | | @ApiModelProperty("是否租住 是否租住(0.否 1.是)") |
| | | @NotBlank(groups = {AddGroup.class},message = "是否租住不可为空") |
| | | private Integer isRent; |
| | | |
| | | @ApiModelProperty("文化程度(1.小学 2.初中 3.高中 4.中专 5.大专 6.本科 7.硕士 8.博士 9.其他)") |
| | | private Integer cultureLevel; |
| | | |
| | | @ApiModelProperty("文化程度") |
| | | private String cultureLevel; |
| | | |
| | | |
| | | @ApiModelProperty("婚姻状况") |
| | | private String marriage; |
| | | |
| | | @ApiModelProperty("婚姻状况(1.未婚 2.已婚 3.离异 4.丧偶 5.分居 6.其他)") |
| | | private Integer marriage; |
| | | |
| | | @ApiModelProperty("健康状况") |
| | | private String healthy; |
| | | |
| | | @ApiModelProperty("与户主关系(1.户主 2.配偶 3.子女 4.孙女 5.父母 6.其他)") |
| | | private Integer relation; |
| | | |
| | | @ApiModelProperty("外地or本地(1.本地 2.外地)") |
| | | private Integer outOrLocal; |
| | | |
| | | @ApiModelProperty("户口所在地") |
| | | private String censusRegister; |
| | | |
| | | public interface sex{ |
| | | int nan = 1; |
| | | int nv = 2; |
| | |
| | | private String name; |
| | | @ApiModelProperty(value = "身份证") |
| | | private String idCard; |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8") |
| | | @ApiModelProperty(value = "入党时间") |
| | | private Date joinTime; |
| | | @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8") |
| | |
| | | @ApiModelProperty("商品详情") |
| | | private String details; |
| | | |
| | | /** |
| | | * 配送方式(1.商家配送 2.快递物流) |
| | | */ |
| | | @ApiModelProperty(value = "配送方式(1.商家配送 2.快递物流)",hidden = true) |
| | | private Integer deliveryType; |
| | | |
| | | @ApiModelProperty("商品规格") |
| | | @Valid |
| | | private List<AddShopGoodsAttrVO> goodsAttrVOList; |
New file |
| | |
| | | package com.panzhihua.common.model.vos.shop; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @ApiModel("订单创建返回参数") |
| | | public class ComShopHiddenConfVO { |
| | | |
| | | @ApiModelProperty(value = "id") |
| | | private Long id; |
| | | @ApiModelProperty(value = "是否隐藏所有商家 0 否 1是") |
| | | private String hidden; |
| | | |
| | | } |
New file |
| | |
| | | package com.panzhihua.common.model.vos.shop; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | |
| | | @Data |
| | | @ApiModel("订单创建返回参数") |
| | | public class ComShopSysConfVO { |
| | | |
| | | @ApiModelProperty(value = "id") |
| | | private Long id; |
| | | @ApiModelProperty(value = "配置名称") |
| | | private String name; |
| | | @ApiModelProperty(value = "配置备注") |
| | | private String note; |
| | | @ApiModelProperty(value = "配置值") |
| | | private String val; |
| | | @ApiModelProperty(value = "是否生效(0 否 1 是)") |
| | | private String enabled; |
| | | |
| | | } |
| | |
| | | |
| | | |
| | | @ApiModelProperty("店铺登陆账号") |
| | | //@Pattern(groups = {AddGroup.class}, message="【密码】格式为6-16个字符,英文,数字,且必须包含英文和数字",regexp="^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,16}$") |
| | | //@Pattern(message="【密码】格式为6-16个字符,英文,数字,且必须包含英文和数字",regexp="^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,16}$") |
| | | @NotBlank(message = "店铺登陆账号不能为空") |
| | | private String storeAccount; |
| | | |
| | |
| | | |
| | | |
| | | @ApiModelProperty("配送方式(1.商家配送 2.快递物流)") |
| | | @NotNull(message = "配送方式(1.商家配送 2.快递物流)") |
| | | @NotNull(message = "配送方式(1.商家配送 2.快递物流)不能为空") |
| | | private Integer deliveryType; |
| | | |
| | | |
| | |
| | | private Long id; |
| | | |
| | | @ApiModelProperty("商家简介") |
| | | @Size(max = 25,min = 1,message = "简介长度不符合!") |
| | | @Size(max = 25,min = 0,message = "简介长度不符合!") |
| | | private String storeDescribe; |
| | | |
| | | } |
| | |
| | | @ApiModelProperty(value = "商铺Id") |
| | | private String shopStorePhone; |
| | | |
| | | @ApiModelProperty(value = "用户昵称") |
| | | private String nickName; |
| | | |
| | | } |
| | |
| | | |
| | | @ApiModelProperty("户口本照片 逗号隔开") |
| | | private String familyBook; |
| | | |
| | | @ApiModelProperty("职业") |
| | | private String job; |
| | | } |
| | |
| | | /** |
| | | * 用户id |
| | | */ |
| | | @ApiModelProperty(value = "用户id",hidden = true) |
| | | @ApiModelProperty(value = "用户id") |
| | | private Long userId; |
| | | |
| | | /** |
| | |
| | | import com.panzhihua.common.model.vos.shop.ShopOperLogVO; |
| | | import com.panzhihua.common.model.vos.shop.AddShopGoodsVO; |
| | | import com.panzhihua.common.model.vos.shop.ShopStoreVO; |
| | | import com.panzhihua.common.model.vos.user.UserElectronicFileVO; |
| | | import com.panzhihua.common.model.vos.user.UserPhoneVO; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.validation.Valid; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | @PostMapping("/neighbor/neighborCommentReplyByApp") |
| | | R neighborCommentReplyByApp(@RequestBody ComActNeighborCommentReplyAppDTO commentReplyAppDTO); |
| | | |
| | | /** |
| | | * 实有房屋_编辑 |
| | | * @param villageId 实有房屋id |
| | | * @param comMngVillageVO 请求参数 |
| | | * @return |
| | | */ |
| | | @PostMapping("/editvillage/{villageId}") |
| | | R editvillage(@PathVariable("villageId") Long villageId,@RequestBody ComMngVillageVO comMngVillageVO); |
| | | |
| | | /** |
| | | * 商城系统配置 |
| | | * @param comShopSysConfDTO |
| | | * @return |
| | | */ |
| | | @PostMapping("/shop/conf/edit") |
| | | R editShopSysConf(@RequestBody ComShopSysConfDTO comShopSysConfDTO); |
| | | |
| | | /** |
| | | * 商城系统配置查询 |
| | | * @param pageComShopSysConfDTO |
| | | * @return |
| | | */ |
| | | @PostMapping("/shop/conf/get") |
| | | R pageShopSysConf(@RequestBody PageComShopSysConfDTO pageComShopSysConfDTO); |
| | | |
| | | /** |
| | | * 编辑实有人口_电子档案 |
| | | * @param userElectronicFileVO |
| | | * @return |
| | | */ |
| | | @PostMapping("/common/data/population/edit/electronicArchives") |
| | | R editUserElectronicFile(@RequestBody UserElectronicFileVO userElectronicFileVO); |
| | | } |
| | |
| | | package com.panzhihua.common.utlis; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.panzhihua.common.exceptions.ServiceException; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | import java.util.Base64; |
| | |
| | | log.info("请求公安实名认证接口,请求地址:" + URL); |
| | | log.info("请求公安实名认证接口,请求参数:" + param); |
| | | log.info("请求公安实名认证接口,请求头参数:" + headervalue + encodeToString); |
| | | String postByJson = HttpClientUtil.sendPostByJson(URL, param, 0, headerkey, headervalue + encodeToString); |
| | | String postByJson = HttpClientUtil.sendPostByJson(URL, param, 2, headerkey, headervalue + encodeToString); |
| | | log.info("请求公安实名认证接口,返回参数:" + postByJson); |
| | | if(postByJson!=null) { |
| | | int code = JSONObject.parseObject(postByJson).getIntValue("code"); |
| | | if (0==code) { |
| | | result =true; |
| | | } |
| | | }else{ |
| | | throw new ServiceException("公安实名认证接口超时,请重试"); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | |
| | | return R.ok(); |
| | | } |
| | | |
| | | @ApiOperation(value = "实有人口编辑") |
| | | |
| | | @ApiOperation(value = "编辑实有人口") |
| | | @PostMapping(value = "/population/edit") |
| | | public R editPopulationInfo(@RequestBody EditComMngPopulationVO editComMngPopulationVO){ |
| | | LoginUserInfoVO loginUserInfo = getLoginUserInfo(); |
| | |
| | | List<String> head17 = new ArrayList<String>(); |
| | | head17.add("工作单位"); |
| | | List<String> head18 = new ArrayList<String>(); |
| | | head18.add("备注"); |
| | | head18.add("本地/外地"); |
| | | List<String> head19 = new ArrayList<String>(); |
| | | head19.add("户口所在地"); |
| | | List<String> head20 = new ArrayList<String>(); |
| | | head20.add("备注"); |
| | | list.add(head0); |
| | | list.add(head1); |
| | | list.add(head2); |
| | |
| | | list.add(head16); |
| | | list.add(head17); |
| | | list.add(head18); |
| | | list.add(head19); |
| | | list.add(head20); |
| | | return list; |
| | | } |
| | | |
| | |
| | | data.add(""); |
| | | data.add(""); |
| | | data.add("阿里巴巴"); |
| | | data.add("本地"); |
| | | data.add("四川成都"); |
| | | data.add(""); |
| | | return data; |
| | | } |
| | |
| | | return R.fail(); |
| | | } |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "编辑实有人口_电子档案") |
| | | @PostMapping("/population/edit/electronicArchives") |
| | | R editPopulation(@RequestBody UserElectronicFileVO userElectronicFileVO){ |
| | | return communityService.editUserElectronicFile(userElectronicFileVO); |
| | | } |
| | | } |
| | |
| | | |
| | | @ApiOperation(value = "编辑便民服务商家") |
| | | @PutMapping("/business/put") |
| | | public R putComCvtBusiness(@RequestBody ComCvtBusinessDTO comCvtBusinessDTO) { |
| | | public R putComCvtBusiness(@Validated(AddGroup.class) @RequestBody ComCvtBusinessDTO comCvtBusinessDTO) { |
| | | return communityService.putComCvtBusiness(comCvtBusinessDTO); |
| | | } |
| | | |
| | |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | log.error("导入模板失败【{}】", e.getMessage()); |
| | | return R.fail(); |
| | | } |
| | | return R.ok(); |
| | | } |
| | |
| | | return R.ok(); |
| | | } |
| | | |
| | | @ApiOperation(value = "编辑实有房屋", response = ComMngVillageVO.class) |
| | | @PostMapping("editvillage/{villageId}") |
| | | public R editvillage(@PathVariable("villageId")Long villageId,@Valid @RequestBody ComMngVillageVO comMngVillageVO) { |
| | | LoginUserInfoVO loginUserInfo = this.getLoginUserInfo(); |
| | | Long communityId = loginUserInfo.getCommunityId(); |
| | | comMngVillageVO.setCommunityId(communityId); |
| | | return communityService.editvillage(villageId,comMngVillageVO); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | |
| | | import com.panzhihua.common.model.dtos.community.PageComMngVillageDTO; |
| | | import com.panzhihua.common.model.vos.R; |
| | | import com.panzhihua.common.model.vos.community.ComMngCarExcelVO; |
| | | import com.panzhihua.common.model.vos.community.ComMngVillageServeExcelVO; |
| | | import com.panzhihua.common.model.vos.community.ComMngVillageVO; |
| | | import com.panzhihua.service_community.service.ComMngVillageService; |
| | |
| | | return R.ok(r); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 社区后台导入实有房屋 |
| | | * @param list 数据 |
| | |
| | | return comMngVillageService.listSaveVillage(list,communityId); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 编辑实有房屋 |
| | | * @param villageId 动态id |
| | | * @return 删除结果 |
| | | */ |
| | | @PostMapping("editvillage/{villageId}") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R editvillage(@PathVariable("villageId")Long villageId,@Valid @RequestBody ComMngVillageVO comMngVillageVO) { |
| | | return comMngVillageService.editVillage(villageId,comMngVillageVO); |
| | | } |
| | | } |
| | |
| | | import com.panzhihua.common.model.dtos.user.PageInputUserDTO; |
| | | import com.panzhihua.common.model.vos.R; |
| | | import com.panzhihua.common.model.vos.community.*; |
| | | import com.panzhihua.common.model.vos.user.UserElectronicFileVO; |
| | | import com.panzhihua.common.validated.AddGroup; |
| | | import com.panzhihua.service_community.service.*; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("/car/save") |
| | | public R saveComMngCar(@RequestBody ComMngCarSaveDTO comMngCarSaveDTO) { |
| | | public R saveComMngCar(@Validated({AddGroup.class}) @RequestBody ComMngCarSaveDTO comMngCarSaveDTO) { |
| | | return comMngCarService.saveComMngCar(comMngCarSaveDTO); |
| | | } |
| | | |
| | |
| | | * @param Ids 删除id集合 |
| | | * @return 删除结果 |
| | | */ |
| | | @ApiOperation(value = "批量删除实有人口") |
| | | @PostMapping("/population/delete") |
| | | public R deletePopulations(@RequestBody List<Long> Ids) { |
| | | return comMngPopulationService.deletePopulations(Ids); |
| | |
| | | * @param communityId 社区id |
| | | * @return 查询结果 |
| | | */ |
| | | @ApiOperation(value = "根据社区id查询所有实有人口") |
| | | @PostMapping("/population/getAll") |
| | | public R getPopulationListByCommunityId(@RequestParam(value = "communityId") Long communityId) { |
| | | return comMngPopulationService.getPopulationListByCommunityId(communityId); |
| | |
| | | * @param Ids 实有人口id集合 |
| | | * @return 查询结果 |
| | | */ |
| | | @ApiOperation(value = "批量删除实有人口") |
| | | @PostMapping("/population/getList") |
| | | public R getPopulationLists(@RequestBody List<Long> Ids) { |
| | | return comMngPopulationService.getPopulationLists(Ids); |
| | |
| | | public R deleteSpecialInputUser(@RequestParam(value = "id") Long id){ |
| | | return comMngPopulationService.deleteSpecialInputUser(id); |
| | | } |
| | | |
| | | /** |
| | | * 编辑实有人口_电子档案 |
| | | * @param userElectronicFileVO |
| | | * @return |
| | | */ |
| | | @PostMapping("/population/edit/electronicArchives") |
| | | R editPopulation(@RequestBody UserElectronicFileVO userElectronicFileVO){ |
| | | return comMngPopulationService.editUserElectronicFile(userElectronicFileVO); |
| | | } |
| | | |
| | | } |
| | |
| | | * @param vo 请求参数 |
| | | */ |
| | | @PostMapping("changeCommentStatusByAdmin") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R changeCommentStatusByAdmin(@RequestBody ChangeCommentStatusByAdminVO vo) { |
| | | return comActNeighborCircleService.changeCommentStatusByAdmin(vo); |
| | | } |
| | |
| | | package com.panzhihua.service_community.api; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.panzhihua.common.model.dtos.shop.PageComShopGoodsDTO; |
| | | import com.panzhihua.common.model.dtos.shop.*; |
| | | import com.panzhihua.common.controller.BaseController; |
| | |
| | | import com.panzhihua.common.model.dtos.shop.PageComShopOrderSearchDTO; |
| | | import com.panzhihua.common.model.dtos.shop.PageComShopStoreDTO; |
| | | import com.panzhihua.common.model.vos.R; |
| | | import com.panzhihua.common.model.vos.shop.AddShopGoodsVO; |
| | | import com.panzhihua.common.model.vos.shop.*; |
| | | import com.panzhihua.service_community.model.dos.ComShopSysConfDO; |
| | | import com.panzhihua.service_community.service.*; |
| | | import com.panzhihua.common.model.vos.shop.ShopOperLogVO; |
| | | import com.panzhihua.common.model.vos.shop.ShopStoreVO; |
| | | import com.panzhihua.service_community.service.ComShopGoodsService; |
| | | import com.panzhihua.service_community.service.ComShopOperLogService; |
| | | import com.panzhihua.service_community.service.ComShopOrderService; |
| | | import com.panzhihua.service_community.service.ComShopStoreService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | |
| | | private ComShopCartService comShopCartService; |
| | | @Resource |
| | | private ComShopUserAddressService comShopUserAddressService; |
| | | @Resource |
| | | private ComShopSysConfService comShopSysConfService; |
| | | |
| | | /** |
| | | * 店铺列表-分页查询 |
| | |
| | | public R wxPay(@RequestBody OrderPayDTO orderPayDTO){ |
| | | return comShopOrderService.wxPay(orderPayDTO); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 商城系统配置 |
| | | * @param comShopSysConfDTO |
| | | * @return |
| | | */ |
| | | @PostMapping("/conf/edit") |
| | | R editShopSysConf(@RequestBody ComShopSysConfDTO comShopSysConfDTO){ |
| | | ComShopSysConfDO comShopSysConfDO = comShopSysConfService.getBaseMapper().selectById(comShopSysConfDTO.getId()); |
| | | switch (comShopSysConfDTO.getHidden()){ |
| | | case 0: |
| | | comShopSysConfDO.setVal("0"); |
| | | comShopSysConfDO.setEnabled("1"); |
| | | break; |
| | | case 1: |
| | | comShopSysConfDO.setVal("1"); |
| | | comShopSysConfDO.setEnabled("1"); |
| | | break; |
| | | default: break; |
| | | } |
| | | int updated = comShopSysConfService.getBaseMapper().updateById(comShopSysConfDO); |
| | | if(updated==1){ |
| | | return R.ok(); |
| | | } |
| | | return R.fail(); |
| | | } |
| | | |
| | | /** |
| | | * 商城系统配置查询 |
| | | * @param pageComShopSysConfDTO |
| | | * @return |
| | | */ |
| | | @PostMapping("/conf/get") |
| | | R pageShopSysConf(@RequestBody PageComShopSysConfDTO pageComShopSysConfDTO){ |
| | | List<ComShopSysConfDO> confList = comShopSysConfService.getBaseMapper().selectList(new LambdaQueryWrapper<ComShopSysConfDO>() |
| | | .eq(ComShopSysConfDO::getName, "SHOP_HIDDEN") |
| | | .orderByDesc(ComShopSysConfDO::getCreate_at)); |
| | | ComShopSysConfVO comShopSysConfVO = new ComShopSysConfVO(); |
| | | if(confList!=null && confList.size()>0){ |
| | | ComShopSysConfDO firstConf = confList.get(0); |
| | | BeanUtils.copyProperties(firstConf, comShopSysConfVO); |
| | | return R.ok(comShopSysConfVO); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | } |
| | |
| | | " </if> " + |
| | | " </where>" + |
| | | " group by w.id \n"+ |
| | | "ORDER BY w.`status` asc, w.create_at desc "+ |
| | | "ORDER BY w.create_at desc "+ |
| | | "</script>") |
| | | IPage<ComActMicroWishVO> pageMicroWish(Page page, @Param("comActMicroWishVO") ComActMicroWishVO comActMicroWishVO); |
| | | @Select("SELECT\n" + |
| | |
| | | " from com_act_neighbor_circle_comment_reply as reply" + |
| | | " left join sys_user su1 on su1.user_id = reply.user_id " + |
| | | " left join sys_user su2 on su2.user_id = reply.parent_user_id " + |
| | | " where reply.comment_id = #{commentId} order by create_at desc" + |
| | | " where reply.status = 1 and reply.comment_id = #{commentId} order by create_at desc" + |
| | | " </script>") |
| | | List<ComActNeighborCircleCommentReplyAppVO> getCircleCommentReplyList(@Param("commentId") Long commentId); |
| | | |
| | |
| | | " from com_act_neighbor_circle_comment_reply as reply" + |
| | | " left join sys_user as su on su.user_id = reply.user_id" + |
| | | " left join sys_user as su1 on su1.user_id = reply.parent_user_id" + |
| | | " where reply.comment_id = #{commentId}") |
| | | " where reply.comment_id = #{commentId} and reply.status = 1") |
| | | IPage<ComActNeighborCommentReplyAppVO> neighborCommentReplyByApp(Page page, @Param("commentId") Long commentId); |
| | | |
| | | } |
| | |
| | | " LEFT JOIN com_act t1 ON t.community_id = t1.community_id " + |
| | | " LEFT JOIN com_mng_struct_area t2 ON t2.id = t.area_id " + |
| | | " LEFT JOIN sys_user t3 ON t.create_by = t3.user_id " + |
| | | " WHERE t.source =2 " + |
| | | " WHERE 1=1" + |
| | | "<if test='pageComMngCarDTO.name != null and pageComMngCarDTO.name.trim() != ""'>" + |
| | | " and t.user_name LIKE concat( '%',#{pageComMngCarDTO.name}, '%' ) " + |
| | | " </if> " + |
| | |
| | | "cmp.native_place,\n" + |
| | | "cmp.nation, \n" + |
| | | "cmp.label, \n" + |
| | | "cmp.relation, \n" + |
| | | "cmp.marriage, \n" + |
| | | "cmp.culture_level, \n" + |
| | | "cmp.out_or_local, \n" + |
| | | "cmp.census_register, \n" + |
| | | "cmp.healthy, \n" + |
| | | "cmp.is_rent \n" + |
| | | "FROM \n" + |
| | | "com_mng_population AS cmp " + |
| | |
| | | "<if test='comMngPopulationVO.sex != null and comMngPopulationVO.sex != ""'>" + |
| | | "AND cmp.sex = #{comMngPopulationVO.sex} " + |
| | | " </if> " + |
| | | "<if test='comMngPopulationVO.ageStart != null'>" + |
| | | "<if test='comMngPopulationVO.ageStart != null and comMngPopulationVO.ageStart != ""'>" + |
| | | "AND cmp.age <![CDATA[ >= ]]> #{comMngPopulationVO.ageStart} " + |
| | | " </if> " + |
| | | "<if test='comMngPopulationVO.ageEnd != null'>" + |
| | | "<if test='comMngPopulationVO.ageEnd != null and comMngPopulationVO.ageEnd != ""'>" + |
| | | "AND cmp.age <![CDATA[ <= ]]> #{comMngPopulationVO.ageEnd} " + |
| | | " </if> " + |
| | | "<if test='comMngPopulationVO.nativePlace != null and comMngPopulationVO.nativePlace != ""'>" + |
| | |
| | | @Select("select user_id,card_photo_front,card_photo_back,family_book from sys_user where id_card=#{idCard}") |
| | | UserElectronicFileVO getSysUserElectronicFile(@Param("idCard") String idCard); |
| | | |
| | | @Select("select user_id,card_photo_front,card_photo_back,family_book from sys_user where user_id=#{userId}") |
| | | UserElectronicFileVO getSysUserById(@Param("userId") Long userId); |
| | | |
| | | @Select("update sys_user set card_photo_front=#{vo.cardPhotoFront},card_photo_back=#{vo.cardPhotoBack},family_book=#{vo.familyBook} where user_id=#{vo.userId}") |
| | | void updateSysUserElectronicFile(@Param("vo") UserElectronicFileVO vo); |
| | | } |
| | |
| | | " and t.name LIKE concat( #{pageComMngRealAssetsDTO.name}, '%' ) " + |
| | | " </if> " + |
| | | "<if test='pageComMngRealAssetsDTO.communityId != null and pageComMngRealAssetsDTO.communityId != 0'>" + |
| | | " and t.community_id = #{pageComMngRealCompanyDTO.communityId} " + |
| | | " and t.community_id = #{pageComMngRealAssetsDTO.communityId} " + |
| | | " </if> " + |
| | | " order by t.create_at desc"+ |
| | | "</script>") |
| | |
| | | "AND community_id=#{comMngStructAreaVO.communityId} \n" + |
| | | " </if> " + |
| | | "<if test='comMngStructAreaVO.areaName != null and comMngStructAreaVO.areaName.trim() != ""'>" + |
| | | "AND area_name = concat( '%',#{comMngStructAreaVO.areaName}, '%' )" + |
| | | "AND area_name like concat( '%',#{comMngStructAreaVO.areaName}, '%' )" + |
| | | " </if> " + |
| | | "</script>") |
| | | IPage<ComMngStructAreaVO> pageArea(Page page, @Param("comMngStructAreaVO") ComMngStructAreaVO comMngStructAreaVO); |
| | |
| | | "u.name userName,u.type as userType\n" + |
| | | "FROM\n" + |
| | | "com_ops_house d\n" + |
| | | "JOIN sys_user u ON d.user_id = u.user_id\n" + |
| | | " LEFT JOIN sys_user u ON d.user_id = u.user_id\n" + |
| | | " LEFT JOIN com_mng_struct_area sa ON d.house_community_id = sa.id \n" + |
| | | "where 1=1 " + |
| | | "<if test='pageComOpsHouseDTO.communityId != null '>" + |
| | | "AND d.community_id=#{pageComOpsHouseDTO.communityId} \n" + |
| | | "AND ( d.community_id=#{pageComOpsHouseDTO.communityId} or sa.community_id=#{pageComOpsHouseDTO.communityId} )\n" + |
| | | " </if> " + |
| | | |
| | | |
New file |
| | |
| | | package com.panzhihua.service_community.dao; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.panzhihua.service_community.model.dos.ComShopCartDO; |
| | | import com.panzhihua.service_community.model.dos.ComShopSysConfDO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * @auther lyq |
| | | * @create 2021-04-14 15:02:14 |
| | | * @describe 购物车表mapper类 |
| | | */ |
| | | @Mapper |
| | | public interface ComShopSysConfDAO extends BaseMapper<ComShopSysConfDO> { |
| | | |
| | | } |
| | |
| | | @EncryptDecryptField |
| | | private String phone; |
| | | /** |
| | | * 外地or本地(1.本地 2.外地) |
| | | */ |
| | | private Integer outOrLocal; |
| | | /** |
| | | * 户口所在地 |
| | | */ |
| | | private String censusRegister; |
| | | /** |
| | | * 备注 |
| | | */ |
| | | private String remark; |
| | |
| | | private String villageName; |
| | | |
| | | /** |
| | | * 与户主关系 |
| | | * 与户主关系(1.户主 2.配偶 3.子女 4.孙女 5.父母 6.其他) |
| | | */ |
| | | private String relation; |
| | | private Integer relation; |
| | | |
| | | /** |
| | | * 文化程度 |
| | | * 文化程度(1.小学 2.初中 3.高中 4.中专 5.大专 6.本科 7.硕士 8.博士 9.其他) |
| | | */ |
| | | private String cultureLevel; |
| | | private Integer cultureLevel; |
| | | |
| | | /** |
| | | * 婚姻状况 |
| | | * 婚姻状况(1.未婚 2.已婚 3.离异 4.丧偶 5.分居 6.其他) |
| | | */ |
| | | private String marriage; |
| | | private Integer marriage; |
| | | |
| | | /** |
| | | * 健康状况 |
| | |
| | | int no = 13; |
| | | } |
| | | |
| | | /** |
| | | * 外地or本地(1.本地 2.外地) |
| | | */ |
| | | public interface outOrLocal{ |
| | | int bd = 1; |
| | | int wd = 2; |
| | | } |
| | | |
| | | } |
| | |
| | | private Long receiverId; |
| | | |
| | | /** |
| | | * 删除状态(1.未删除 2.已删除) |
| | | * 是否已删除(1.是 2.否) |
| | | */ |
| | | private Integer deleteStatus; |
| | | |
New file |
| | |
| | | package com.panzhihua.service_community.model.dos; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | |
| | | |
| | | /** |
| | | * @auther lyq |
| | | * @create 2021-04-14 15:03:01 |
| | | * @describe 订单表实体类 |
| | | */ |
| | | |
| | | @Data |
| | | @TableName("com_shop_sys_conf") |
| | | public class ComShopSysConfDO implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 订单id |
| | | */ |
| | | @TableId(type = IdType.AUTO) |
| | | private Long id; |
| | | /** |
| | | * 配置名称 |
| | | */ |
| | | private String name; |
| | | /** |
| | | * 配置备注 |
| | | */ |
| | | private String note; |
| | | /** |
| | | * 配置值 |
| | | */ |
| | | private String val; |
| | | /** |
| | | * 是否生效(0 否 1 是) |
| | | */ |
| | | private String enabled; |
| | | /** |
| | | * 创建人 |
| | | */ |
| | | private String create_by; |
| | | /** |
| | | * 创建时间 |
| | | */ |
| | | private Date create_at; |
| | | /** |
| | | * 修改时间 |
| | | */ |
| | | private Date update_at; |
| | | /** |
| | | * 修改人 |
| | | */ |
| | | private String update_by; |
| | | } |
| | |
| | | R detailNeighborCommentReply(Long id); |
| | | |
| | | /** |
| | | * 评论的状态_修改 |
| | | * 评论的回复状态_修改 |
| | | * @param changeStatusReplyVO |
| | | * @return |
| | | */ |
| | |
| | | import com.panzhihua.common.model.vos.community.ComMngPopulationServeExcelVO; |
| | | import com.panzhihua.common.model.vos.community.ComMngPopulationVO; |
| | | import com.panzhihua.common.model.vos.community.EditComMngPopulationVO; |
| | | import com.panzhihua.common.model.vos.user.UserElectronicFileVO; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | * @return 实有人口电子档信息 |
| | | */ |
| | | R electronicArchivesPopulation(Long populationId); |
| | | |
| | | /** |
| | | * 编辑电子档案 |
| | | * @param userElectronicFileVO |
| | | * @return |
| | | */ |
| | | R editUserElectronicFile(UserElectronicFileVO userElectronicFileVO); |
| | | } |
| | |
| | | * @return |
| | | */ |
| | | R listSaveVillage(List<ComMngVillageServeExcelVO> list, Long communityId); |
| | | |
| | | /** |
| | | * 实有房屋编辑 |
| | | * @param villageId |
| | | * @param comMngVillageVO |
| | | * @return |
| | | */ |
| | | R editVillage(Long villageId, ComMngVillageVO comMngVillageVO); |
| | | } |
New file |
| | |
| | | package com.panzhihua.service_community.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.panzhihua.service_community.model.dos.ComShopOrderPayDO; |
| | | import com.panzhihua.service_community.model.dos.ComShopSysConfDO; |
| | | |
| | | /** |
| | | * @author cedoo |
| | | * @create 2021-5-11 10:47:50 |
| | | * @describe |
| | | */ |
| | | public interface ComShopSysConfService extends IService<ComShopSysConfDO> { |
| | | |
| | | } |
| | |
| | | /*if(now.getTime()<comActActivityVO.getBeginAt().getTime()){ |
| | | comActActivityDO.setStatus(3); |
| | | }*/ |
| | | if(status.intValue()==2) {//点击‘保存并发布’ 按钮 |
| | | //报名结束时间大于当前时间则设置为“进行中” |
| | | if(comActActivityVO.getSignUpEnd()!=null && now.getTime()<comActActivityVO.getSignUpEnd().getTime()){ |
| | | comActActivityDO.setStatus(4); |
| | | } |
| | | } |
| | | |
| | | boolean save = this.save(comActActivityDO); |
| | | if(!save){ |
| | |
| | | */ |
| | | @Override |
| | | public R addDynamicUser(Long id, Long userId) { |
| | | ComActDynUserDO comActDynUserDO = comActDynUserDAO.selectOne(new QueryWrapper<ComActDynUserDO>().lambda().eq(ComActDynUserDO::getDynId, id).eq(ComActDynUserDO::getUserId, userId)); |
| | | if (ObjectUtils.isEmpty(comActDynUserDO)) { |
| | | comActDynUserDO=new ComActDynUserDO(); |
| | | ComActDynUserDO comActDynUserDO = new ComActDynUserDO(); |
| | | comActDynUserDO.setCreateAt(new Date()); |
| | | comActDynUserDO.setDynId(id); |
| | | comActDynUserDO.setUserId(userId); |
| | |
| | | return R.ok(); |
| | | } |
| | | return R.fail(); |
| | | }else{ |
| | | return R.fail(); |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | |
| | | AdministratorsUserVO user = this.baseMapper.selectUserByUserId(commentDO.getUserId()); |
| | | ComActNeighborCommentByAdminVO vo = new ComActNeighborCommentByAdminVO(); |
| | | BeanUtils.copyProperties(commentDO,vo); |
| | | vo.setUserName(user.getName()); |
| | | String name = user.getName()==null?user.getNickName():user.getName(); |
| | | vo.setUserName(name); |
| | | return R.ok(vo); |
| | | } |
| | | |
| | |
| | | }else{ |
| | | List<Long> areaIds = comCvtBusinessAreaService.getBusinessServiceAreaIds(comCvtBusinessDO.getId()); |
| | | if(!ObjectUtils.isEmpty(areaIds)){ |
| | | List<ComActDO> busiDO = comActDAO.selectBatchIds(areaIds); |
| | | comActDOS = comActDAO.selectBatchIds(areaIds); |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | Map<String, Long> businessMap = getBusinessMap(comCvtBusinessDOS); |
| | | list.forEach(comCvtServeExcelVO -> { |
| | | /** |
| | | * 便民服务分类存在 并且 便民服务商家 匹配上 |
| | | */ |
| | | if (categoryMap.containsKey(comCvtServeExcelVO.getCategoryName()) && businessMap.containsKey(comCvtServeExcelVO.getBusinessName())) { |
| | | ComCvtServeDO comCvtServeDO = new ComCvtServeDO(); |
| | | BeanUtils.copyProperties(comCvtServeExcelVO, comCvtServeDO); |
| | |
| | | import com.panzhihua.common.model.vos.user.ComMngFamilyInfoVO; |
| | | import com.panzhihua.common.model.vos.user.InputUserInfoVO; |
| | | import com.panzhihua.common.model.vos.user.UserElectronicFileVO; |
| | | import com.panzhihua.common.utlis.AgeUtils; |
| | | import com.panzhihua.service_community.dao.ComActDAO; |
| | | import com.panzhihua.service_community.dao.ComActVillageDAO; |
| | | import com.panzhihua.service_community.dao.ComMngPopulationDAO; |
| | |
| | | import java.security.InvalidKeyException; |
| | | import java.security.NoSuchAlgorithmException; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | |
| | | page.setSize(pageSize); |
| | | page.setCurrent(pageNum); |
| | | IPage<ComMngPopulationVO> iPage = populationDAO.pagePopulation(page, comMngPopulationVO); |
| | | iPage.getRecords().forEach(vo->{ |
| | | //获取用户生日 |
| | | String date = vo.getCardNo().substring(6, 14); |
| | | String year = date.substring(0,4); |
| | | String month = date.substring(4,6); |
| | | String day = date.substring(6,8); |
| | | String birthday = year + "-" + month + "-" + day; |
| | | //设置用户年龄 |
| | | vo.setBirthday(birthday); |
| | | }); |
| | | return R.ok(iPage); |
| | | } |
| | | |
| | |
| | | if(populationDO==null){ |
| | | return R.fail(); |
| | | } |
| | | String cardNo = populationDO.getCardNo(); |
| | | BeanUtils.copyProperties(vo,populationDO); |
| | | try { |
| | | //TODO 修改拦截器时候需要维护加密操作 |
| | | populationDO.setCardNo(AESUtil.encrypt128(populationDO.getCardNo(), aesKey)); |
| | | populationDO.setPhone(AESUtil.encrypt128(populationDO.getPhone(), aesKey)); |
| | | |
| | | } catch (NoSuchPaddingException e) { |
| | | if(!cardNo.equals(vo.getCardNo())){//判断是否修改身份证号码 |
| | | //判断要修改的身份证号码是否已存在 |
| | | ComMngPopulationDO cardNoDO = populationDAO.selectOne(new QueryWrapper<ComMngPopulationDO>() |
| | | .lambda().eq(ComMngPopulationDO::getCardNo,vo.getCardNo())); |
| | | if(cardNoDO != null){ |
| | | return R.fail("您输入的身份证已存在,请重新输入"); |
| | | } |
| | | populationDO.setCardNo(AESUtil.encrypt128(vo.getCardNo(), aesKey)); |
| | | }else{ |
| | | populationDO.setCardNo(AESUtil.encrypt128(cardNo, aesKey)); |
| | | } |
| | | populationDO.setPhone(AESUtil.encrypt128(vo.getPhone(), aesKey)); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } catch (NoSuchAlgorithmException e) { |
| | | e.printStackTrace(); |
| | | } catch (InvalidKeyException e) { |
| | | e.printStackTrace(); |
| | | } catch (UnsupportedEncodingException e) { |
| | | e.printStackTrace(); |
| | | } catch (BadPaddingException e) { |
| | | e.printStackTrace(); |
| | | } catch (IllegalBlockSizeException e) { |
| | | e.printStackTrace(); |
| | | return R.fail(); |
| | | } |
| | | |
| | | ComMngVillageDO comMngVillageDO = comActVillageDAO.selectOne(new QueryWrapper<ComMngVillageDO>().eq("alley",vo.getRoad()).eq("house_num",vo.getDoorNo()).eq("community_id",communityId)); |
| | | if (comMngVillageDO == null) { |
| | | throw new ServiceException("街道巷:" + vo.getRoad() + "不存在!"); |
| | | return R.fail("街道巷:" + vo.getRoad() + vo.getDoorNo() + "不存在!"); |
| | | // throw new ServiceException("街道巷:" + vo.getRoad() + "不存在!"); |
| | | } |
| | | populationDO.setVillageId(comMngVillageDO.getVillageId()); |
| | | populationDO.setActId(comActDO.getCommunityId()); |
| | | populationDO.setStreetId(comActDO.getStreetId()); |
| | | if(!StringUtils.isEmpty(comMngVillageDO.getGroupAt())){ |
| | | populationDO.setVillageName(comMngVillageDO.getGroupAt()); |
| | | this.updateById(populationDO); |
| | | } |
| | | populationDO.setUpdateAt(new Date()); |
| | | // this.updateById(populationDO); |
| | | if(populationDAO.updateById(populationDO) > 0){ |
| | | return R.ok(); |
| | | }else{ |
| | | return R.fail("修改失败"); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | @Override |
| | | public R editUserElectronicFile(UserElectronicFileVO userElectronicFileVO) { |
| | | UserElectronicFileVO electronicFileVO = populationDAO.getSysUserById(userElectronicFileVO.getUserId()); |
| | | if(electronicFileVO==null){ |
| | | return R.fail("id有误!"); |
| | | } |
| | | populationDAO.updateSysUserElectronicFile(userElectronicFileVO); |
| | | return R.ok(); |
| | | } |
| | | } |
| | |
| | | import com.panzhihua.service_community.dao.ComActDAO; |
| | | import com.panzhihua.service_community.dao.ComActVillageDAO; |
| | | import com.panzhihua.service_community.dao.ComMngPopulationDAO; |
| | | import com.panzhihua.service_community.dao.ComMngVolunteerMngDAO; |
| | | import com.panzhihua.service_community.model.dos.ComActDO; |
| | | import com.panzhihua.service_community.model.dos.ComActDiscussDO; |
| | | import com.panzhihua.service_community.model.dos.ComMngPopulationDO; |
| | | import com.panzhihua.service_community.model.dos.ComMngVillageDO; |
| | | import com.panzhihua.service_community.service.ComMngVillageService; |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * @author: llming |
| | |
| | | this.saveBatch(comMngVillageDOS); |
| | | return R.ok("共计导入实有房屋数量:" + comMngVillageDOS.size()); |
| | | } |
| | | |
| | | @Override |
| | | public R editVillage(Long villageId, ComMngVillageVO comMngVillageVO) { |
| | | ComMngVillageDO comMngVillageDO = this.baseMapper.selectById(villageId); |
| | | if (comMngVillageDO == null) { |
| | | return R.fail("id有误!"); |
| | | } |
| | | BeanUtils.copyProperties(comMngVillageVO, comMngVillageDO); |
| | | ComActDO comActDO = comActDAO.selectById(comMngVillageDO.getCommunityId()); |
| | | if (comActDO == null || comActDO.getStreetId() == null) { |
| | | return R.fail("社区没有绑定街道,请绑定后操作!"); |
| | | } |
| | | comMngVillageDO.setStreetId(comActDO.getStreetId()); |
| | | int update = this.baseMapper.update(comMngVillageDO, new LambdaQueryWrapper<ComMngVillageDO>() |
| | | .eq(ComMngVillageDO::getVillageId, villageId)); |
| | | if(update>0){ |
| | | return R.ok(comMngVillageVO); |
| | | } |
| | | return R.fail(); |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | //查询默认收货地址 |
| | | //查询上次购买记录的收货地址 |
| | | List<ComShopOrderDO> shopOrders = this.baseMapper.selectList(new QueryWrapper<ComShopOrderDO>() |
| | | .eq("user_id",orderPreviewDTO.getUserId()).orderByDesc("create_at")); |
| | | if(shopOrders.isEmpty()){//未查询到用户上一笔订单 |
| | | //查询用户收货地址中的默认地址 |
| | | ComShopUserAddressDO userAddressDO = comShopUserAddressDAO.selectOne(new QueryWrapper<ComShopUserAddressDO>() |
| | | ComShopUserAddressDO userDefaultAddressDO = comShopUserAddressDAO.selectOne(new QueryWrapper<ComShopUserAddressDO>() |
| | | .eq("delete_status", 2) |
| | | .eq("user_id",orderPreviewDTO.getUserId()).eq("is_default",ComShopUserAddressDO.isDefault.yes)); |
| | | |
| | | //查询用户收货地址中的默认地址 |
| | | if(userDefaultAddressDO != null){ |
| | | ComShopUserAddressVO userAddressVO = new ComShopUserAddressVO(); |
| | | BeanUtils.copyProperties(userDefaultAddressDO,userAddressVO); |
| | | orderPreviewVO.setUserAddressVO(userAddressVO); |
| | | }else{ |
| | | //查询上次购买记录的收货地址 |
| | | //查询到用户上一笔订单 |
| | | List<ComShopOrderDO> shopOrders = this.baseMapper.selectList(new QueryWrapper<ComShopOrderDO>() |
| | | .eq("delete_status", 2) |
| | | .eq("user_id",orderPreviewDTO.getUserId()) |
| | | .orderByDesc("create_at")); |
| | | if(shopOrders!=null && shopOrders.size()>0) { |
| | | ComShopUserAddressDO userAddressDO = comShopUserAddressDAO.selectById(shopOrders.get(0).getReceiverId()); |
| | | if(userAddressDO != null){ |
| | | ComShopUserAddressVO userAddressVO = new ComShopUserAddressVO(); |
| | | BeanUtils.copyProperties(userAddressDO,userAddressVO); |
| | | orderPreviewVO.setUserAddressVO(userAddressVO); |
| | | }else{ |
| | | } |
| | | } |
| | | //无默认地址, 无上一单记录 地址 |
| | | /* |
| | | if(orderPreviewVO.getUserAddressVO()==null){ |
| | | List<ComShopUserAddressDO> userAddressDOList = comShopUserAddressDAO.selectList(new QueryWrapper<ComShopUserAddressDO>() |
| | | .eq("user_id",orderPreviewDTO.getUserId()).orderByDesc("create_at")); |
| | | if(!userAddressDOList.isEmpty()){ |
| | |
| | | orderPreviewVO.setUserAddressVO(userAddressVO); |
| | | } |
| | | } |
| | | }else{//查询到用户上一笔订单 |
| | | ComShopUserAddressDO userAddressDO = comShopUserAddressDAO.selectById(shopOrders.get(0).getReceiverId()); |
| | | if(userAddressDO != null){ |
| | | if(userAddressDO.getDeleteStatus() == 2) { |
| | | ComShopUserAddressVO userAddressVO = new ComShopUserAddressVO(); |
| | | BeanUtils.copyProperties(userAddressDO, userAddressVO); |
| | | orderPreviewVO.setUserAddressVO(userAddressVO); |
| | | */ |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | return R.ok(orderPreviewVO); |
| | | } |
| | | |
| | |
| | | public R shopStoreDetail(PageComShopStoreDTO comShopStoreDTO) { |
| | | //查询店铺 |
| | | ComShopStoreDO storeDO = this.baseMapper.selectById(comShopStoreDTO.getStoreId()); |
| | | if (storeDO == null) { |
| | | boolean storeDeleted = storeDO!=null && 2==storeDO.getDeleteStatus(); |
| | | if (storeDO == null || storeDeleted) { |
| | | return R.fail(401, "店铺不存在"); |
| | | } |
| | | if (storeDO.getStatus().equals(ComShopStoreDO.status.no)) { |
New file |
| | |
| | | package com.panzhihua.service_community.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.panzhihua.service_community.dao.*; |
| | | import com.panzhihua.service_community.model.dos.*; |
| | | import com.panzhihua.service_community.service.ComShopSysConfService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * @auther cedoo |
| | | * @create 2021-5-11 12:20:37 |
| | | * @describe 商品系统配置 |
| | | */ |
| | | @Slf4j |
| | | @Service |
| | | public class ComShopSysConfServiceImpl extends ServiceImpl<ComShopSysConfDAO, ComShopSysConfDO> implements ComShopSysConfService { |
| | | |
| | | } |
| | |
| | | " left join com_act as ca on ca.community_id = cpm.community_id " + |
| | | " left join com_pb_org as cpo on cpo.id = cpm.org_id " + |
| | | " LEFT JOIN sys_user u ON cpm.id_card = u.id_card " + |
| | | " where cpm.community_id = #{organizationVO.communityId} " + |
| | | " where cpm.community_id = #{organizationVO.communityId} and cpm.audit_result = 1 " + |
| | | "<if test='organizationVO.orgName != null'>" + |
| | | " and cpo.name LIKE CONCAT('%',#{organizationVO.orgName},'%') "+ |
| | | " </if> " + |
| | |
| | | comPbActivityDO.setEnrollTimeBegin(now); |
| | | comPbActivityDO.setCreateAt(now); |
| | | |
| | | Integer status = partyBuildingActivityVO.getStatus(); |
| | | if(status!=null && status.intValue()==2) {//点击'保存并发布' 按钮 |
| | | //默认设置为“进行中” |
| | | comPbActivityDO.setStatus(4); |
| | | } |
| | | |
| | | int insert = comBpActivityDAO.insert(comPbActivityDO); |
| | | if (insert > 0) { |
| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.panzhihua.common.constants.UserConstants; |
| | | import com.panzhihua.common.exceptions.PartyBuildingMemberException; |
| | | import com.panzhihua.common.model.vos.R; |
| | | import com.panzhihua.common.model.vos.community.ComActActivityVO; |
| | |
| | | if (delete>0) { |
| | | // 维护用户表党员状态 |
| | | comPbMemberDAO.updateUserIsPartymember(comPbMemberDO.getIdCard()); |
| | | //删除缓存 |
| | | String userKey = UserConstants.LOGIN_USER_INFO + comPbMemberDO.getUserId(); |
| | | stringRedisTemplate.delete(userKey); |
| | | return R.ok(); |
| | | } |
| | | return R.fail(); |
| | |
| | | if(partyBuildingMemberVO.getAuditResult()!=null && partyBuildingMemberVO.getAuditResult().equals(1)){ |
| | | comPbMemberDO.setUpdateAt(new Date()); |
| | | } |
| | | |
| | | //编辑 |
| | | if(partyBuildingMemberVO.getJoinTime()!=null) { |
| | | comPbMemberDO.setJoinTime(partyBuildingMemberVO.getJoinTime()); |
| | | } |
| | | if(partyBuildingMemberVO.getEmploymentTime()!=null) { |
| | | comPbMemberDO.setEmploymentTime(partyBuildingMemberVO.getEmploymentTime()); |
| | | } |
| | | if(partyBuildingMemberVO.getIdCard()!=null &&!partyBuildingMemberVO.getIdCard().contains("*")){ |
| | | comPbMemberDO.setIdCard(partyBuildingMemberVO.getIdCard()); |
| | | } |
| | | if(partyBuildingMemberVO.getName()!=null ){ |
| | | comPbMemberDO.setName(partyBuildingMemberVO.getName()); |
| | | } |
| | | if(partyBuildingMemberVO.getOrgId()!=null ){ |
| | | comPbMemberDO.setOrgId(partyBuildingMemberVO.getOrgId()); |
| | | } |
| | | if(partyBuildingMemberVO.getPhotoPath()!=null ){ |
| | | comPbMemberDO.setPhotoPath(partyBuildingMemberVO.getPhotoPath()); |
| | | } |
| | | |
| | | if (comPbMemberDAO.updateById(comPbMemberDO) > 0) { |
| | | PartyBuildingMemberVO rtVO = new PartyBuildingMemberVO(); |
| | | BeanUtils.copyProperties(comPbMemberDO, rtVO); |
| | |
| | | public List<PartyOrganizationVO> listPartyOrganizationByApp(ComListPartyDTO comListPartyDTO){ |
| | | List<PartyOrganizationVO> partyOrganizationVOS = new ArrayList<>(); |
| | | QueryWrapper<ComPbOrgDO> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.lambda().eq(ComPbOrgDO::getCommunityId, comListPartyDTO.getCommunityId()).eq(ComPbOrgDO::getStatus, 1); |
| | | queryWrapper.lambda().eq(ComPbOrgDO::getStatus, 1); |
| | | if(comListPartyDTO.getCommunityId() != null){ |
| | | queryWrapper.lambda().eq(ComPbOrgDO::getCommunityId, comListPartyDTO.getCommunityId()); |
| | | } |
| | | if(!StringUtils.isEmpty(comListPartyDTO.getName())){ |
| | | queryWrapper.lambda().like(ComPbOrgDO::getName,comListPartyDTO.getName()); |
| | | } |
| | |
| | | " card_photo_front = #{userArchivesVO.cardPhotoFront} \n" + |
| | | ", card_photo_back = #{userArchivesVO.cardPhotoBack} \n" + |
| | | ",family_book = #{userArchivesVO.familyBook} \n" + |
| | | ",job = #{userArchivesVO.job} \n" + |
| | | " where user_id = #{userArchivesVO.userId}") |
| | | void updateUserArchives(@Param("userArchivesVO") UpdateUserArchivesVO userArchivesVO); |
| | | |
| | |
| | | loginUserInfoVO.setIsmemberrole(1); |
| | | } |
| | | } |
| | | loginUserInfoVO.setIsRealNamed(sysUserDO.getIdCard()!=null); |
| | | return R.ok(loginUserInfoVO); |
| | | } |
| | | |
| | |
| | | */ |
| | | @Override |
| | | public R putUserIsVolunteer(String phone, int type) { |
| | | |
| | | SysUserDO sysUserDO = new SysUserDO(); |
| | | sysUserDO.setIsVolunteer(type); |
| | | //????根据手机号匹配 |
| | | int update = userDao.update(sysUserDO, new UpdateWrapper<SysUserDO>().lambda().eq(SysUserDO::getPhone, phone)); |
| | | if (update > 0) { |
| | | ComMngVolunteerMngVO comMngVolunteerMngVO = userDao.selectVolunteerMngByPhone(phone); |
| | | if(comMngVolunteerMngVO!=null&&comMngVolunteerMngVO.getSubmitUserId()!=null) { |
| | | Long userId = comMngVolunteerMngVO.getSubmitUserId(); |
| | | //删除用户信息缓存 |
| | | String userKey = UserConstants.LOGIN_USER_INFO + userId; |
| | | stringRedisTemplate.delete(userKey); |
| | | }else{ |
| | | List<SysUserDO> userDOList = userDao.selectList(new LambdaQueryWrapper<SysUserDO>().eq(SysUserDO::getPhone, phone)); |
| | | if(userDOList!=null && userDOList.size()>0){ |
| | | userDOList.forEach(usrDo ->{ |
| | | Long userId = usrDo.getUserId(); |
| | | //删除用户信息缓存 |
| | | String userKey = UserConstants.LOGIN_USER_INFO + userId; |
| | | stringRedisTemplate.delete(userKey); |
| | | }); |
| | | } |
| | | } |
| | | return R.ok(); |
| | | } |
| | | return R.fail(); |
| | |
| | | } |
| | | int update = userDao.updateById(sysUserDO); |
| | | if (update > 0) { |
| | | //删除用户信息缓存 |
| | | String userKey = UserConstants.LOGIN_USER_INFO + userId; |
| | | stringRedisTemplate.delete(userKey); |
| | | return R.ok(); |
| | | } |
| | | } |
| | |
| | | String idCard = loginUserInfoVO.getIdCard(); |
| | | String name = loginUserInfoVO.getName(); |
| | | log.info("用户实名认证发送请求,姓名:" + name + "身份证号码:" + idCard); |
| | | try { |
| | | boolean b = RealNameUtil.authentication(idCard, name); |
| | | if (!b) { |
| | | return R.fail("身份认证失败:请填写真实信息"); |
| | | } |
| | | }catch (ServiceException serviceException){ |
| | | return R.fail(serviceException.getMessage()); |
| | | } |
| | | SysUserDO sysUserDO = new SysUserDO(); |
| | | sysUserDO.setName(name); |
| | | sysUserDO.setIdCard(idCard); |
| | | sysUserDO.setSex(loginUserInfoVO.getSex()); |
| | | sysUserDO.setBirthday(loginUserInfoVO.getBirthday()); |
| | | //通过身份证号判断性别以及出生日期 |
| | | sysUserDO.setSex(IdCard.sex(idCard)); |
| | | sysUserDO.setBirthday(IdCard.birthDay(idCard)); |
| | | sysUserDO.setJob(loginUserInfoVO.getJob()); |
| | | sysUserDO.setUserId(loginUserInfoVO.getUserId()); |
| | | sysUserDO.setFaceUrl(loginUserInfoVO.getFaceUrl()); |
| | |
| | | SysUserDO sysUserDO = userDao.selectOne(new QueryWrapper<SysUserDO>().lambda().eq(SysUserDO::getIdCard,idCard).eq(SysUserDO::getType,1)); |
| | | if(sysUserDO != null){ |
| | | sysUserDO.setIsPartymember(1); |
| | | userDao.updateById(sysUserDO); |
| | | int updated = userDao.updateById(sysUserDO); |
| | | if(updated>0){ |
| | | //删除用户信息缓存 |
| | | String userKey = UserConstants.LOGIN_USER_INFO + sysUserDO.getUserId(); |
| | | stringRedisTemplate.delete(userKey); |
| | | } |
| | | log.info("新增党员修改用户党员状态成功 身份证号【{}】", idCard); |
| | | } |
| | | return R.ok(); |
| | |
| | | SysUserDO sysUserDO = userDao.selectOne(new QueryWrapper<SysUserDO>().lambda().eq(SysUserDO::getIdCard,idCard).eq(SysUserDO::getType,1)); |
| | | if(sysUserDO != null){ |
| | | sysUserDO.setIsPartymember(0); |
| | | userDao.updateById(sysUserDO); |
| | | int updated = userDao.updateById(sysUserDO); |
| | | if(updated>0) { |
| | | //删除用户信息缓存 |
| | | String userKey = UserConstants.LOGIN_USER_INFO + sysUserDO.getUserId(); |
| | | stringRedisTemplate.delete(userKey); |
| | | } |
| | | log.info("新增党员修改用户为非党员状态成功 身份证号【{}】", idCard); |
| | | } |
| | | return R.ok(); |
| | |
| | | } |
| | | addShopGoodsVO.setStoreId(shopStoreVO.getId()); |
| | | //addShopGoodsVO.setName(shopStoreVO.getName()); |
| | | addShopGoodsVO.setDeliveryType(shopStoreVO.getDeliveryType()); |
| | | return communityService.saveShopGoods(addShopGoodsVO); |
| | | }else{ |
| | | return R.fail(); |
New file |
| | |
| | | package com.panzhihua.zuul.config; |
| | | |
| | | import com.panzhihua.common.constants.SecurityConstants; |
| | | import com.panzhihua.zuul.filters.AppletAuthenticationFilter; |
| | | import org.springframework.boot.autoconfigure.security.SecurityProperties; |
| | | import org.springframework.context.annotation.Configuration; |
| | | import org.springframework.core.annotation.Order; |
| | | import org.springframework.security.config.annotation.web.builders.HttpSecurity; |
| | | import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; |
| | | import org.springframework.security.web.authentication.AnonymousAuthenticationFilter; |
| | | |
| | | /** |
| | | * @ClasssName AppletWebSecurityConfigurationAdapter |
| | | * @Description 小程序 |
| | | * @Author cedoo |
| | | * @Date 2021/4/30 |
| | | * @Version 1.0 |
| | | **/ |
| | | @Configuration |
| | | @Order(SecurityProperties.BASIC_AUTH_ORDER-2) |
| | | public class AppletWebSecurityConfigurationAdapter extends WebSecurityConfigurerAdapter { |
| | | @Override |
| | | protected void configure(HttpSecurity http) throws Exception { |
| | | http.antMatcher("/api/applets/**").authorizeRequests() |
| | | .anyRequest().authenticated() |
| | | .and() |
| | | .addFilterAfter(new AppletAuthenticationFilter(), AnonymousAuthenticationFilter.class); |
| | | } |
| | | } |
New file |
| | |
| | | package com.panzhihua.zuul.config; |
| | | |
| | | |
| | | import lombok.Data; |
| | | import org.springframework.boot.context.properties.ConfigurationProperties; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Component |
| | | @ConfigurationProperties(prefix = "applet.realname") |
| | | @Data |
| | | public class RealNamedConfig { |
| | | |
| | | private List<String> verify; |
| | | |
| | | } |
| | |
| | | */ |
| | | @Resource |
| | | private UserAuthAccessDeniedHandler userAuthAccessDeniedHandler; |
| | | |
| | | @Override |
| | | protected void configure(HttpSecurity http) throws Exception { |
| | | http.authorizeRequests() |
| | |
| | | // 禁用缓存 |
| | | http.headers().cacheControl(); |
| | | http.addFilterBefore(new JWTAuthenticationTokenFilter(), AnonymousAuthenticationFilter.class); |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.panzhihua.zuul.filters; |
| | | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.panzhihua.common.constants.*; |
| | | import com.panzhihua.common.model.vos.R; |
| | | import com.panzhihua.common.utlis.JWTTokenUtil; |
| | | import com.panzhihua.common.utlis.ResultUtil; |
| | | import com.panzhihua.zuul.config.RealNamedConfig; |
| | | import io.jsonwebtoken.Claims; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.ApplicationContext; |
| | | import org.springframework.data.redis.core.StringRedisTemplate; |
| | | import org.springframework.data.redis.core.ValueOperations; |
| | | import org.springframework.security.core.authority.SimpleGrantedAuthority; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.web.context.support.WebApplicationContextUtils; |
| | | |
| | | import javax.servlet.*; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.concurrent.atomic.AtomicBoolean; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: 小程序权限验证 |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-11-25 16:35 |
| | | **/ |
| | | @Component |
| | | public class AppletAuthenticationFilter implements Filter { |
| | | private StringRedisTemplate stringRedisTemplate; |
| | | |
| | | @Autowired |
| | | private RealNamedConfig realNamedConfig; |
| | | |
| | | |
| | | @Override |
| | | public void init(FilterConfig filterConfig) throws ServletException { |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 用户是否登录校验 |
| | | * |
| | | * @param servletRequest 请求 |
| | | * @param servletResponse 返回 |
| | | * @param filterChain 过滤器链条 |
| | | * @throws IOException io |
| | | * @throws ServletException servlet |
| | | */ |
| | | @Override |
| | | public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { |
| | | HttpServletRequest request = (HttpServletRequest) servletRequest; |
| | | SafeboxRequestWrapper safeboxRequestWrapper = new SafeboxRequestWrapper(request); |
| | | HttpServletResponse response = (HttpServletResponse) servletResponse; |
| | | |
| | | // 获取请求头中JWT的Token |
| | | String tokenHeader = request.getHeader(TokenConstant.TOKEN_HEADER); |
| | | if (null != tokenHeader && tokenHeader.startsWith(TokenConstant.TOKEN_PRE) |
| | | &&realNamedConfig!=null && realNamedConfig.getVerify()!=null &&realNamedConfig.getVerify().size()>0) { |
| | | String token = tokenHeader.replace(TokenConstant.TOKEN_PRE, ""); |
| | | |
| | | // token解析 |
| | | Claims claims = JWTTokenUtil.getClaimsFromToken(token); |
| | | if(claims!=null) {//检查token有效 |
| | | String username = claims.getSubject(); |
| | | int type = (Integer) claims.get("type"); |
| | | if (1 == type) {//小程序用户统一角色 |
| | | String requestURI = request.getRequestURI(); |
| | | String requestMethod = request.getMethod().toLowerCase(); |
| | | |
| | | ServletContext context = request.getServletContext(); |
| | | ApplicationContext ctx = WebApplicationContextUtils.getWebApplicationContext(context); |
| | | stringRedisTemplate = ctx.getBean(StringRedisTemplate.class); |
| | | ValueOperations<String, String> valueOperations = stringRedisTemplate.opsForValue(); |
| | | String appletUserRoleKey = SecurityConstants.ROLE_APPLETS_USER + username; |
| | | Boolean userHasRole = stringRedisTemplate.hasKey(appletUserRoleKey); |
| | | |
| | | boolean needCheck = false; |
| | | List<String> checkedUrl = realNamedConfig.getVerify(); |
| | | checkedUrl = checkedUrl != null ? checkedUrl : new ArrayList<>(); |
| | | for (int i = 0; i < checkedUrl.size(); i++) { |
| | | String url = checkedUrl.get(i); |
| | | if (url.toLowerCase().startsWith(requestMethod) && url.endsWith(requestURI)) { |
| | | needCheck = true; |
| | | } else { |
| | | continue; |
| | | } |
| | | } |
| | | if (needCheck) { |
| | | if (userHasRole) { |
| | | boolean userHashRight = false; |
| | | try { |
| | | String roles = valueOperations.get(appletUserRoleKey); |
| | | List<SimpleGrantedAuthority> authorities = JSONArray.parseArray(roles, SimpleGrantedAuthority.class); |
| | | if (authorities != null && authorities.size() > 0) { |
| | | AtomicBoolean userHasRightRole = new AtomicBoolean(false); |
| | | authorities.forEach(authority -> { |
| | | if (authority.getAuthority().equals(SecurityConstants.ROLE_APPLETS_REAL_NAMED)) { |
| | | userHasRightRole.set(true); |
| | | } |
| | | }); |
| | | if (userHasRightRole.get()) { |
| | | //用户包含“已实名”角色,则放行 什么也不做 |
| | | userHashRight = true; |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | | userHashRight = false; |
| | | } |
| | | |
| | | if (!userHashRight) { |
| | | ResultUtil.responseJson(response, R.fail(HttpStatus.FORBIDDEN, "用户未实名")); |
| | | return; |
| | | } |
| | | } else { |
| | | ResultUtil.responseJson(response, R.fail(HttpStatus.FORBIDDEN, "用户未实名")); |
| | | return; |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |
| | | } |
| | | filterChain.doFilter(servletRequest, servletResponse); |
| | | } |
| | | |
| | | @Override |
| | | public void destroy() { |
| | | |
| | | } |
| | | } |
| | |
| | | ResultUtil.responseJson(response, R.fail(HttpStatus.UNAUTHORIZED, "token校验失败"));
|
| | | return;
|
| | | }
|
| | | String username = claims.getSubject();
|
| | | String userId = claims.getSubject(); |
| | | int type = (Integer) claims.get("type");
|
| | | if (ObjectUtils.isEmpty(username)) {
|
| | | if (ObjectUtils.isEmpty(userId)) { |
| | | ResultUtil.responseJson(response, R.fail(HttpStatus.UNAUTHORIZED, "token校验失败"));
|
| | | return;
|
| | | }
|
| | | List<SimpleGrantedAuthority> authorities = new ArrayList<>();
|
| | | List<SimpleGrantedAuthority> authorities1 = new ArrayList<>();
|
| | | String key = SecurityConstants.ROLE_USER + username;
|
| | | Boolean aBoolean = stringRedisTemplate.hasKey(key);
|
| | | if (1 == type) {//小程序用户统一角色
|
| | | authorities.add(new SimpleGrantedAuthority(SecurityConstants.ROLE_APPLETS));
|
| | | String roleAppletKey = SecurityConstants.ROLE_APPLETS_USER +userId; |
| | | if(stringRedisTemplate.hasKey(roleAppletKey)){ |
| | | String roles = valueOperations.get(roleAppletKey); |
| | | authorities = JSONArray.parseArray(roles, SimpleGrantedAuthority.class); |
| | | } else {
|
| | | authorities.add(new SimpleGrantedAuthority(SecurityConstants.ROLE_APPLETS)); |
| | | String userKey = UserConstants.LOGIN_USER_INFO + userId; |
| | | Boolean hasKeyLoginUserInfo = stringRedisTemplate.hasKey(userKey); |
| | | if (hasKeyLoginUserInfo) { |
| | | String userInfo = valueOperations.get(userKey); |
| | | LoginUserInfoVO loginUserInfoVO = JSONObject.parseObject(userInfo, LoginUserInfoVO.class); |
| | | //判断用户是否已实名制 |
| | | if (loginUserInfoVO.getIsRealNamed() != null && loginUserInfoVO.getIsRealNamed()) { |
| | | authorities.add(new SimpleGrantedAuthority(SecurityConstants.ROLE_APPLETS_REAL_NAMED)); |
| | | } |
| | | }else{ |
| | | //查询登陆用户信息 |
| | | R<LoginUserInfoVO> r = userService.getUserInfoByUserId(userId); |
| | | if (!R.isOk(r)) { |
| | | ResultUtil.responseJson(response, R.fail(HttpStatus.ERROR, "登录用户信息查询失败")); |
| | | return; |
| | | } |
| | | LoginUserInfoVO data = r.getData(); |
| | | //判断用户是否已实名制 |
| | | if (data.getIsRealNamed() != null && data.getIsRealNamed()) { |
| | | authorities.add(new SimpleGrantedAuthority(SecurityConstants.ROLE_APPLETS_REAL_NAMED)); |
| | | } |
| | | } |
| | | valueOperations.set(roleAppletKey, JSONArray.toJSONString(authorities), 24, TimeUnit.HOURS); |
| | | } |
| | | } else { |
| | | String key = SecurityConstants.ROLE_USER + userId; |
| | | Boolean aBoolean = stringRedisTemplate.hasKey(key); |
| | | if (aBoolean) {
|
| | | String roles = valueOperations.get(key);
|
| | | authorities = JSONArray.parseArray(roles, SimpleGrantedAuthority.class);
|
| | | } else {
|
| | | R<List<String>> r = userService.getUserRoles(username);
|
| | | R<List<String>> r = userService.getUserRoles(userId); |
| | | List<String> data =(List<String>)r.getData();
|
| | | if (!ObjectUtils.isEmpty(data)) {
|
| | | data.forEach(s -> {
|
| | |
| | | }
|
| | | }
|
| | | }
|
| | | UsernamePasswordAuthenticationToken authentication = new UsernamePasswordAuthenticationToken(username, username, authorities);//主要使用权限 账户 密码 不重要
|
| | | UsernamePasswordAuthenticationToken authentication = new UsernamePasswordAuthenticationToken(userId, userId, authorities);//主要使用权限 账户 密码 不重要 |
| | | SecurityContextHolder.getContext().setAuthentication(authentication);
|
| | | safeboxRequestWrapper.addHeader(TokenConstant.TOKEN_LOGOUT,tokenHeader);
|
| | | //登录用户的所有信息
|
| | | String userKey = UserConstants.LOGIN_USER_INFO + username;
|
| | | String userKey = UserConstants.LOGIN_USER_INFO + userId; |
| | | Boolean hasKeyLoginUserInfo = stringRedisTemplate.hasKey(userKey);
|
| | | if(hasKeyLoginUserInfo){
|
| | | String userInfo = valueOperations.get(userKey);
|
| | |
| | | String hexStr = AES.parseByte2HexStr(encrypt);
|
| | | safeboxRequestWrapper.addHeader(TokenConstant.TOKEN_USERINFO, hexStr);
|
| | | }else{
|
| | | R<LoginUserInfoVO> r = userService.getUserInfoByUserId(username);
|
| | | R<LoginUserInfoVO> r = userService.getUserInfoByUserId(userId); |
| | | if (!R.isOk(r)) {
|
| | | ResultUtil.responseJson(response, R.fail(HttpStatus.ERROR, "登录用户信息查询失败"));
|
| | | return;
|
New file |
| | |
| | | package com.panzhihua.zuul.handles; |
| | | |
| | | import com.panzhihua.common.constants.HttpStatus; |
| | | import com.panzhihua.common.model.vos.R; |
| | | import com.panzhihua.common.utlis.ResultUtil; |
| | | import org.apache.tomcat.util.http.fileupload.impl.FileSizeLimitExceededException; |
| | | import org.springframework.web.bind.annotation.ControllerAdvice; |
| | | import org.springframework.web.bind.annotation.ExceptionHandler; |
| | | import org.springframework.web.multipart.MaxUploadSizeExceededException; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | @ControllerAdvice |
| | | public class FileUploadExceptionAdvice { |
| | | |
| | | @ExceptionHandler(MaxUploadSizeExceededException.class) |
| | | public void handleMaxSizeException( |
| | | MaxUploadSizeExceededException exc, |
| | | HttpServletRequest request, |
| | | HttpServletResponse response) { |
| | | //请求超过大小限制 |
| | | response.setContentType("application/json;charset=utf-8"); |
| | | ResultUtil.responseJson(response, R.fail(HttpStatus.REQUEST_TOO_LARGE, "请求主体的大小超过限制")); |
| | | return; |
| | | |
| | | } |
| | | |
| | | @ExceptionHandler(FileSizeLimitExceededException.class) |
| | | public void handleFileSizeLimitException( |
| | | FileSizeLimitExceededException exc, |
| | | HttpServletRequest request, |
| | | HttpServletResponse response) { |
| | | //请求超过大小限制 |
| | | response.setContentType("application/json;charset=utf-8"); |
| | | ResultUtil.responseJson(response, R.fail(HttpStatus.REQUEST_TOO_LARGE, "文件大小超过限制")); |
| | | return; |
| | | } |
| | | |
| | | } |
| | |
| | | active: ${ENV:dev} |
| | | servlet: |
| | | multipart: |
| | | max-file-size: 10MB |
| | | max-request-size: 10MB |
| | | max-file-size: 20MB |
| | | max-request-size: 22MB |
| | | |
| | | eureka: |
| | | client: |
| | | service-url: |
| | | defaultZone: http://${EUREKA_URL:localhost}:8192/eureka |
| | | |
| | | |
| | | |
| | | # applet 需实名认证的接口地址 |
| | | applet: |
| | | realname: |
| | | verify: |
| | | - POST:/api/applets/house |
| | | - POST:/api/applets/putHouse |
| | | - POST:/api/applets/undercarriageHouse |
| | | - GET:/api/applets/delHouse |
| | | - POST:/api/applets/questnaire/add |
| | | - GET:/api/applets/questnaire/delete |
| | | - POST:/api/applets/questnaire/edit |
| | | - GET:/api/applets/questnaire/stat/details |
| | | - POST:/api/applets/questnaire/toggle |
| | | - POST:/api/applets/questnaire/stat/answer |
| | | - POST:/api/applets/index/comacteasyphotocomment |
| | | - POST:/api/applets/index/commentsign |
| | | - POST:/api/applets/index/addmessageback |
| | | - POST:/api/applets/index/addmessage |
| | | - POST:/api/applets/index/easyphoto |
| | | - PUT:/api/applets/index/easyphoto |
| | | - POST:/api/applets/index/microwish |
| | | - PUT:/api/applets/index/microwish |
| | | - POST:/api/applets/discuss |
| | | - POST:/api/applets/discusscommentback |
| | | - POST:/api/applets/discusscomment |
| | | - PUT:/api/applets/discusscommentuser |
| | | - POST:/api/applets/discussuser |
| | | - PUT:/api/applets/discussuser |
| | | - POST:/api/applets/neighbor/addNeighborByApp |
| | | - POST:/api/applets/neighbor/cancel/fabulous |
| | | - POST:/api/applets/neighbor/comment |
| | | - POST:/api/applets/neighbor/fabulous |
| | | - POST:/api/applets/neighbor/reply |
| | | - PUT:/api/applets/community/signactivity |
| | | - POST:/api/applets/community/volunteer |
| | | - POST:/api/applets/user/houses |
| | | - POST:/api/appletsbackstage/common/data/car/save |
| | | - DELETE:/api/appletsbackstage/common/data/car/delete |
| | | - POST:/api/applets/community/car/register |
| | | - PUT:/api/applets/partybuilding/activitysignup |
| | | - GET:/api/applets/questnaire/stat |
| | | - GET:/api/applets/questnaire/view |
| | | - POST:/api/applets/user/addfamily |
| | | - PUT:/api/applets/user/putfamily |
| | | - POST:/api/applets/user/getUserArchives |
| | | - POST:/api/applets/user/updateUserArchives |
| | | - POST:/api/applets/user/partybuildingembercertification |
| | | - GET:/api/applets/user/partybuildingembercertification |
| | | - GET:/api/applets/index/pagemymessage |
| | | - POST:/api/applets/index/pagemymessage |
| | | - POST:/api/applets/user/listactivity |
| | | - POST:/api/applets/partybuilding/activityinfo |
| | | - PUT:/api/applets/user/microwishconfirm |
| | | - POST:/api/applets/user/pagemicrowish |
| | | - POST:/api/applets/user/pageeasyphoto |
| | | - POST:/api/applets/neighbor/user/page |
| | | - GET:/api/applets/user/listfamily |