Merge branch 'test' into 'test_bak'
Test
See merge request root/zhihuishequ!203
| | |
| | | |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | import java.time.Instant; |
| | | import java.util.UUID; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | @ApiOperation(value = "新增便民服务商家") |
| | | @PostMapping("/merchant/add") |
| | | public R addMerchant(@RequestBody @Validated(AddGroup.class) ConvenientMerchantDTO convenientMerchantDTO) { |
| | | log.error("catTimeStamp进入appletsbackstage", Instant.now().toEpochMilli()); |
| | | convenientMerchantDTO.setCreatedBy(this.getUserId()); |
| | | return communityService.addMerchant(convenientMerchantDTO); |
| | | } |
New file |
| | |
| | | package com.panzhihua.common.model.dtos; |
| | | |
| | | import lombok.Data; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.context.annotation.Configuration; |
| | | |
| | | /** |
| | | * @author lyq |
| | | * ftp配置信息传递类 |
| | | */ |
| | | @Data |
| | | public class FtpConfig { |
| | | |
| | | private String userName; |
| | | private String password; |
| | | private String host; |
| | | private int port; |
| | | private String url; |
| | | private String excelUrl; |
| | | } |
| | |
| | | @ApiModelProperty("操作记录") |
| | | private List<ComActReserveMakeOperationAdminVO> operationList; |
| | | |
| | | @ApiModelProperty("处理人/备注人") |
| | | private String handleName; |
| | | |
| | | } |
| | |
| | | private Date reserveTime; |
| | | @ExcelProperty(value = "预约内容" ,index = 4) |
| | | private String content; |
| | | @ExcelProperty(value = "备注" ,index = 5) |
| | | private String remark; |
| | | @ExcelProperty(value = "备注人" ,index = 5) |
| | | private String handleName; |
| | | @ExcelProperty(value = "社区备注" ,index = 6) |
| | | private String actRemark; |
| | | @ExcelProperty(value = "提交时间" ,index = 7) |
| | |
| | | @ExcelProperty(value = "预约内容" ,index = 5) |
| | | private String content; |
| | | |
| | | @ExcelProperty(value = "备注" ,index = 6) |
| | | private String remark; |
| | | @ExcelProperty(value = "备注人" ,index = 6) |
| | | private String handleName; |
| | | |
| | | @ExcelProperty(value = "社区备注" ,index = 7) |
| | | private String actRemark; |
| | |
| | | @ApiModelProperty("预约登记主题") |
| | | private String title; |
| | | |
| | | @ApiModelProperty("处理人/备注人") |
| | | private String handleName; |
| | | |
| | | } |
| | |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date createAt; |
| | | |
| | | @ApiModelProperty("处理人/备注人") |
| | | private String handleName; |
| | | |
| | | } |
| | |
| | | * @return 删除结果 |
| | | */ |
| | | @PostMapping("common/data/special/delete") |
| | | R deleteSpecialInputUser(@RequestParam(value = "id") Long id); |
| | | R deleteSpecialInputUser(@RequestParam(value = "id") Long id,@RequestParam("communityId") Long communityId); |
| | | |
| | | /** |
| | | * 办事指南_新增 |
New file |
| | |
| | | package com.panzhihua.common.utlis; |
| | | |
| | | import com.panzhihua.common.model.vos.community.ComActQuestnaireAnswerContentVO; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | import java.net.URL; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author lyq |
| | | * 前端H5组件库工具类 |
| | | */ |
| | | @Slf4j |
| | | public class AssemblyUtils { |
| | | |
| | | /** |
| | | * 数据转换--登记明细用户填写答案导出数据格式转换 |
| | | * |
| | | * @param answerContentVOList 用户答题记录 |
| | | * @return 用户填写答案数据 |
| | | */ |
| | | public static List<List<Object>> ReserveData(List<ComActQuestnaireAnswerContentVO> answerContentVOList) { |
| | | //结果数据集合 |
| | | List<List<Object>> resultList = new ArrayList<>(); |
| | | //构建单个用户数据 |
| | | List<Object> userData = new ArrayList<>(); |
| | | //遍历答案列表 |
| | | Long reserveRecordId = 0L; |
| | | Long reserveSubId = 0L; |
| | | Boolean isOldDuo = false; |
| | | StringBuffer sb = new StringBuffer(); |
| | | if (answerContentVOList != null && answerContentVOList.size() > 0) { |
| | | for (ComActQuestnaireAnswerContentVO userAnswers : answerContentVOList) { |
| | | //判断是文字描述直接跳过 |
| | | if (userAnswers.getOptionType().equals(5) || userAnswers.getOptionType().equals(11)) { |
| | | continue; |
| | | } |
| | | //判断reserveRecordId为空则为第一条记录,默认加上昵称和灯谜是 |
| | | if (reserveRecordId.equals(0L)) { |
| | | reserveRecordId = userAnswers.getReserveRecordId(); |
| | | userData.add(userAnswers.getNickName()); |
| | | userData.add(DateUtils.format(userAnswers.getTime(), DateUtils.ymdhms_format)); |
| | | } |
| | | //根据reserveRecordId判断是否是第二条填报记录 |
| | | if (!reserveRecordId.equals(userAnswers.getReserveRecordId())) { |
| | | reserveSubId = 0L; |
| | | |
| | | if(isOldDuo){ |
| | | String answer = sb.toString(); |
| | | userData.add(answer.substring(0, answer.length() - 1)); |
| | | sb = new StringBuffer(); |
| | | isOldDuo = false; |
| | | } |
| | | resultList.add(userData); |
| | | userData = new ArrayList<>(); |
| | | reserveRecordId = userAnswers.getReserveRecordId(); |
| | | userData.add(userAnswers.getNickName()); |
| | | userData.add(DateUtils.format(userAnswers.getTime(), DateUtils.ymdhms_format)); |
| | | if(StringUtils.isNotEmpty(userAnswers.getAnswerContent())){ |
| | | userData.add(userAnswers.getAnswerContent()); |
| | | }else{ |
| | | userData.add(" "); |
| | | } |
| | | }else{ |
| | | if(reserveSubId.equals(0L)){ |
| | | reserveSubId = userAnswers.getReserveSubId(); |
| | | } |
| | | |
| | | if(!reserveSubId.equals(userAnswers.getReserveSubId())){ |
| | | reserveSubId = userAnswers.getReserveSubId(); |
| | | |
| | | //判断当前的组件类型是否是图片上传,导出时需要导出图片 |
| | | if(userAnswers.getOptionType().equals(11)){ |
| | | reserveSubId = userAnswers.getReserveSubId(); |
| | | try { |
| | | userData.add(new URL(userAnswers.getAnswerContent())); |
| | | }catch (Exception e){ |
| | | userData.add(" "); |
| | | log.error("导出转换图片失败!"); |
| | | } |
| | | continue; |
| | | } |
| | | |
| | | if(userAnswers.getOptionType().equals(1)){ |
| | | isOldDuo = true; |
| | | sb.append(userAnswers.getAnswerContent()==null?"无":userAnswers.getAnswerContent() + ","); |
| | | continue; |
| | | }else{ |
| | | isOldDuo = false; |
| | | } |
| | | sb.append(userAnswers.getAnswerContent()==null?"无":userAnswers.getAnswerContent() + ","); |
| | | String answer = sb.toString(); |
| | | userData.add(answer.substring(0, answer.length() - 1)); |
| | | sb = new StringBuffer(); |
| | | }else{ |
| | | //判断当前的组件类型是否是图片上传,导出时需要导出图片 |
| | | if(userAnswers.getOptionType().equals(11)){ |
| | | reserveSubId = userAnswers.getReserveSubId(); |
| | | try { |
| | | userData.add(new URL(userAnswers.getAnswerContent())); |
| | | }catch (Exception e){ |
| | | userData.add(" "); |
| | | log.error("导出转换图片失败!"); |
| | | } |
| | | continue; |
| | | } |
| | | if(userAnswers.getOptionType().equals(1)){ |
| | | isOldDuo = true; |
| | | sb.append(userAnswers.getAnswerContent()==null?"无":userAnswers.getAnswerContent() + ","); |
| | | continue; |
| | | }else{ |
| | | isOldDuo = false; |
| | | } |
| | | sb.append(userAnswers.getAnswerContent()==null?"无":userAnswers.getAnswerContent() + ","); |
| | | String answer = sb.toString(); |
| | | userData.add(answer.substring(0, answer.length() - 1)); |
| | | sb = new StringBuffer(); |
| | | } |
| | | } |
| | | } |
| | | if(isOldDuo){ |
| | | String answer = sb.toString(); |
| | | userData.add(answer.substring(0, answer.length() - 1)); |
| | | } |
| | | resultList.add(userData); |
| | | } |
| | | return resultList; |
| | | } |
| | | } |
New file |
| | |
| | | package com.panzhihua.common.utlis; |
| | | |
| | | import com.alibaba.excel.EasyExcel; |
| | | import com.alibaba.excel.ExcelWriter; |
| | | import com.alibaba.excel.write.metadata.WriteSheet; |
| | | import com.alibaba.excel.write.metadata.style.WriteCellStyle; |
| | | import com.alibaba.excel.write.style.HorizontalCellStyleStrategy; |
| | | import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy; |
| | | import com.panzhihua.common.excel.CustomSheetWriteHandler; |
| | | import com.panzhihua.common.model.dtos.FtpConfig; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | import java.io.File; |
| | | import java.io.FileInputStream; |
| | | import java.io.InputStream; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author lyq |
| | | * excel工具类 |
| | | */ |
| | | @Slf4j |
| | | public class ExcelUtils { |
| | | |
| | | public static String adminExport(FtpConfig config, String name, List<List<String>> headList |
| | | , List<List<Object>> datalist, String sheetName, Object obj) { |
| | | String ftpUrl = "/mnt/data/web/excel/"; |
| | | try { |
| | | SFTPUtil sftp = new SFTPUtil(config.getUserName(), config.getPassword(), config.getHost(), config.getPort()); |
| | | sftp.login(); |
| | | boolean existDir = sftp.isExistDir(ftpUrl + name); |
| | | if (!existDir) { |
| | | String property = System.getProperty("user.dir"); |
| | | String fileName = property + File.separator + name; |
| | | ExcelWriter excelWriter = null; |
| | | InputStream inputStream = null; |
| | | try { |
| | | WriteCellStyle headWriteCellStyle = new WriteCellStyle(); |
| | | WriteCellStyle contentWriteCellStyle = new WriteCellStyle(); |
| | | |
| | | contentWriteCellStyle.setWrapped(true); |
| | | HorizontalCellStyleStrategy horizontalCellStyleStrategy = |
| | | new HorizontalCellStyleStrategy(headWriteCellStyle, contentWriteCellStyle); |
| | | LongestMatchColumnWidthStyleStrategy longestMatchColumnWidthStyleStrategy = new LongestMatchColumnWidthStyleStrategy(); |
| | | |
| | | excelWriter = EasyExcel.write(fileName, Object.class) |
| | | .registerWriteHandler(horizontalCellStyleStrategy) |
| | | .registerWriteHandler(longestMatchColumnWidthStyleStrategy) |
| | | .registerWriteHandler(new CustomSheetWriteHandler()).build(); |
| | | WriteSheet writeSheet = EasyExcel.writerSheet(sheetName).head(headList).build(); |
| | | excelWriter.write(datalist, writeSheet); |
| | | excelWriter.finish(); |
| | | File file = new File(fileName); |
| | | inputStream = new FileInputStream(file); |
| | | sftp.uploadMore(ftpUrl, name, inputStream); |
| | | sftp.logout(); |
| | | inputStream.close(); |
| | | String absolutePath = file.getAbsolutePath(); |
| | | boolean delete = file.delete(); |
| | | log.info("删除excel【{}】结果【{}】", absolutePath, delete); |
| | | } finally { |
| | | // 千万别忘记finish 会帮忙关闭流 |
| | | if (inputStream != null) { |
| | | inputStream.close(); |
| | | } |
| | | if (excelWriter != null) { |
| | | excelWriter.finish(); |
| | | } |
| | | } |
| | | return config.getExcelUrl() + name; |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | log.error("文件传输失败【{}】", e.getMessage()); |
| | | return null; |
| | | } |
| | | return null; |
| | | } |
| | | } |
| | |
| | | import com.panzhihua.common.model.vos.community.reserve.*; |
| | | import com.panzhihua.common.service.community.CommunityService; |
| | | import com.panzhihua.common.service.user.UserService; |
| | | import com.panzhihua.common.utlis.AssemblyUtils; |
| | | import com.panzhihua.common.utlis.DateUtils; |
| | | import com.panzhihua.common.utlis.SFTPUtil; |
| | | import com.panzhihua.common.utlis.StringUtils; |
| | |
| | | headList.add(headn); |
| | | } |
| | | }); |
| | | List<List<Object>> datalist = dataList(questnaireAnswersDTOS.getAnswers()); |
| | | //数据转换 |
| | | List<List<Object>> datalist = AssemblyUtils.ReserveData(questnaireAnswersDTOS.getAnswers()); |
| | | |
| | | WriteCellStyle headWriteCellStyle = new WriteCellStyle(); |
| | | WriteCellStyle contentWriteCellStyle = new WriteCellStyle(); |
| | |
| | | @PostMapping("/register/detailed/detail") |
| | | public R registerDetailedDetail(@RequestParam("reserveRecordId") Long reserveRecordId) { |
| | | return communityService.registerDetailedDetailAdmin(reserveRecordId); |
| | | } |
| | | |
| | | /** |
| | | * 数据转换--登记明细用户填写答案导出数据格式转换 |
| | | * |
| | | * @param answerContentVOList 用户答题记录 |
| | | * @return 用户填写答案数据 |
| | | */ |
| | | private List<List<Object>> dataList(List<ComActQuestnaireAnswerContentVO> answerContentVOList) { |
| | | //结果数据集合 |
| | | List<List<Object>> resultList = new ArrayList<>(); |
| | | //构建单个用户数据 |
| | | List<Object> userData = new ArrayList<>(); |
| | | //遍历答案列表 |
| | | Long reserveRecordId = 0L; |
| | | Long reserveSubId = 0L; |
| | | Boolean isOldDuo = false; |
| | | StringBuffer sb = new StringBuffer(); |
| | | if (answerContentVOList != null && answerContentVOList.size() > 0) { |
| | | for (ComActQuestnaireAnswerContentVO userAnswers : answerContentVOList) { |
| | | //判断是文字描述直接跳过 |
| | | if (userAnswers.getOptionType().equals(5) || userAnswers.getOptionType().equals(11)) { |
| | | continue; |
| | | } |
| | | //判断reserveRecordId为空则为第一条记录,默认加上昵称和灯谜是 |
| | | if (reserveRecordId.equals(0L)) { |
| | | reserveRecordId = userAnswers.getReserveRecordId(); |
| | | userData.add(userAnswers.getNickName()); |
| | | userData.add(DateUtils.format(userAnswers.getTime(), DateUtils.ymdhms_format)); |
| | | } |
| | | //根据reserveRecordId判断是否是第二条填报记录 |
| | | if (!reserveRecordId.equals(userAnswers.getReserveRecordId())) { |
| | | reserveSubId = 0L; |
| | | |
| | | if(isOldDuo){ |
| | | String answer = sb.toString(); |
| | | userData.add(answer.substring(0, answer.length() - 1)); |
| | | sb = new StringBuffer(); |
| | | isOldDuo = false; |
| | | } |
| | | resultList.add(userData); |
| | | userData = new ArrayList<>(); |
| | | reserveRecordId = userAnswers.getReserveRecordId(); |
| | | userData.add(userAnswers.getNickName()); |
| | | userData.add(DateUtils.format(userAnswers.getTime(), DateUtils.ymdhms_format)); |
| | | if(StringUtils.isNotEmpty(userAnswers.getAnswerContent())){ |
| | | userData.add(userAnswers.getAnswerContent()); |
| | | }else{ |
| | | userData.add(" "); |
| | | } |
| | | }else{ |
| | | if(reserveSubId.equals(0L)){ |
| | | reserveSubId = userAnswers.getReserveSubId(); |
| | | } |
| | | |
| | | if(!reserveSubId.equals(userAnswers.getReserveSubId())){ |
| | | reserveSubId = userAnswers.getReserveSubId(); |
| | | |
| | | //判断当前的组件类型是否是图片上传,导出时需要导出图片 |
| | | if(userAnswers.getOptionType().equals(11)){ |
| | | reserveSubId = userAnswers.getReserveSubId(); |
| | | try { |
| | | userData.add(new URL(userAnswers.getAnswerContent())); |
| | | }catch (Exception e){ |
| | | userData.add(" "); |
| | | log.error("导出转换图片失败!"); |
| | | } |
| | | continue; |
| | | } |
| | | |
| | | if(userAnswers.getOptionType().equals(1)){ |
| | | isOldDuo = true; |
| | | sb.append(userAnswers.getAnswerContent()==null?"无":userAnswers.getAnswerContent() + ","); |
| | | continue; |
| | | }else{ |
| | | isOldDuo = false; |
| | | } |
| | | sb.append(userAnswers.getAnswerContent()==null?"无":userAnswers.getAnswerContent() + ","); |
| | | String answer = sb.toString(); |
| | | userData.add(answer.substring(0, answer.length() - 1)); |
| | | sb = new StringBuffer(); |
| | | }else{ |
| | | //判断当前的组件类型是否是图片上传,导出时需要导出图片 |
| | | if(userAnswers.getOptionType().equals(11)){ |
| | | reserveSubId = userAnswers.getReserveSubId(); |
| | | try { |
| | | userData.add(new URL(userAnswers.getAnswerContent())); |
| | | }catch (Exception e){ |
| | | userData.add(" "); |
| | | log.error("导出转换图片失败!"); |
| | | } |
| | | continue; |
| | | } |
| | | if(userAnswers.getOptionType().equals(1)){ |
| | | isOldDuo = true; |
| | | sb.append(userAnswers.getAnswerContent()==null?"无":userAnswers.getAnswerContent() + ","); |
| | | continue; |
| | | }else{ |
| | | isOldDuo = false; |
| | | } |
| | | sb.append(userAnswers.getAnswerContent()==null?"无":userAnswers.getAnswerContent() + ","); |
| | | String answer = sb.toString(); |
| | | userData.add(answer.substring(0, answer.length() - 1)); |
| | | sb = new StringBuffer(); |
| | | } |
| | | } |
| | | } |
| | | // String answer = sb.toString(); |
| | | // if(StringUtils.isNotEmpty(answer)){ |
| | | // userData.add(answer.substring(0, answer.length() - 1)); |
| | | // } |
| | | if(isOldDuo){ |
| | | String answer = sb.toString(); |
| | | userData.add(answer.substring(0, answer.length() - 1)); |
| | | } |
| | | resultList.add(userData); |
| | | } |
| | | return resultList; |
| | | } |
| | | |
| | | } |
| | |
| | | @ApiOperation(value = "特殊群体/删除", response = InputUserInfoVO.class) |
| | | @DeleteMapping("/special/delete") |
| | | public R deleteSpecialInputUser(@RequestParam(value = "id") Long id) { |
| | | return communityService.deleteSpecialInputUser(id); |
| | | // 获取登陆用户绑定社区id |
| | | Long communityId = this.getLoginUserInfo().getCommunityId(); |
| | | return communityService.deleteSpecialInputUser(id,communityId); |
| | | } |
| | | |
| | | // @ApiOperation(value = "特殊群体 导出特殊群体Excel") |
| | | // @PostMapping("/special/export") |
| | | // public R exportSpecial(@RequestBody ExportSpecialUserDTO exportSpecialUserDTO) { |
| | | // exportSpecialUserDTO.setCommunityId(this.getCommunityId()); |
| | | // String url = excelUrl; |
| | | // String uuid = UUID.randomUUID().toString().replace("-", ""); |
| | | // String name = uuid + ".xlsx"; |
| | | // String ftpUrl = "/mnt/data/web/excel/"; |
| | | //// 用户搜索了就下载搜索的用户否则下载所有用户 |
| | | // R r = userService.specialUserExport(exportSpecialUserDTO); |
| | | // if (R.isOk(r)) { |
| | | // List<EexcelUserDTO> eexcelUserDTOS = JSONArray.parseArray(JSONArray.toJSONString(r.getData()), |
| | | // EexcelUserDTO.class); |
| | | // try { |
| | | // SFTPUtil sftp = new SFTPUtil(userName, password, host, port); |
| | | // sftp.login(); |
| | | // boolean existDir = sftp.isExistDir(ftpUrl + name); |
| | | // if (!existDir) { |
| | | // String property = System.getProperty("user.dir"); |
| | | // String fileName = property + File.separator + name; |
| | | // // 这里 需要指定写用哪个class去写 |
| | | // ExcelWriter excelWriter = null; |
| | | // InputStream inputStream = null; |
| | | // try { |
| | | // excelWriter = EasyExcel.write(fileName, EexcelUserDTO.class).registerWriteHandler(new |
| | | // LongestMatchColumnWidthStyleStrategy()).registerWriteHandler(new CustomSheetWriteHandler()).build(); |
| | | // WriteSheet writeSheet = EasyExcel.writerSheet("模板").build(); |
| | | // excelWriter.write(eexcelUserDTOS, writeSheet); |
| | | // excelWriter.finish(); |
| | | // File file = new File(fileName); |
| | | // inputStream = new FileInputStream(file); |
| | | // sftp.uploadMore(ftpUrl, name, inputStream); |
| | | // sftp.logout(); |
| | | // inputStream.close(); |
| | | // String absolutePath = file.getAbsolutePath(); |
| | | // boolean delete = file.delete(); |
| | | // log.info("删除excel【{}】结果【{}】", absolutePath, delete); |
| | | // } finally { |
| | | // // 千万别忘记finish 会帮忙关闭流 |
| | | // if (inputStream != null) { |
| | | // inputStream.close(); |
| | | // } |
| | | // if (excelWriter != null) { |
| | | // excelWriter.finish(); |
| | | // } |
| | | // } |
| | | // } |
| | | // return R.ok(url + name); |
| | | // } catch (Exception e) { |
| | | // e.printStackTrace(); |
| | | // log.error("文件传输失败【{}】", e.getMessage()); |
| | | // return R.fail(); |
| | | // } |
| | | // } |
| | | // return R.fail("未查询到用户"); |
| | | // } |
| | | |
| | | @ApiOperation(value = "特殊群体-数据导出") |
| | | @PostMapping("/special/export") |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import com.panzhihua.common.utlis.AssemblyUtils; |
| | | import com.panzhihua.common.utlis.DateUtils; |
| | | import com.panzhihua.common.utlis.StringUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | } |
| | | headList.add(headn); |
| | | }); |
| | | List<List<Object>> datalist = dataList(questnaireAnswersDTOS.getAnswers()); |
| | | List<List<Object>> datalist = AssemblyUtils.ReserveData(questnaireAnswersDTOS.getAnswers()); |
| | | |
| | | WriteCellStyle headWriteCellStyle = new WriteCellStyle(); |
| | | WriteCellStyle contentWriteCellStyle = new WriteCellStyle(); |
| | |
| | | } |
| | | return communityService.statisticsSummaryHeader(questId, loginUserInfo.getCommunityId()); |
| | | } |
| | | |
| | | /** |
| | | * 数据转换 |
| | | * @param answerContentVOList 用户问答列表数据 |
| | | * @return 调查问卷需要导出数据 |
| | | */ |
| | | private List<List<Object>> dataList(List<ComActQuestnaireAnswerContentVO> answerContentVOList) { |
| | | //结果数据集合 |
| | | List<List<Object>> resultList = new ArrayList<>(); |
| | | //构建单个用户数据 |
| | | List<Object> userData = new ArrayList<>(); |
| | | //遍历答案列表 |
| | | Long reserveRecordId = 0L; |
| | | Long reserveSubId = 0L; |
| | | StringBuffer sb = new StringBuffer(); |
| | | if (answerContentVOList != null && answerContentVOList.size() > 0) { |
| | | for (ComActQuestnaireAnswerContentVO userAnswers : answerContentVOList) { |
| | | //判断是文字描述直接跳过 |
| | | if (userAnswers.getOptionType().equals(5)) { |
| | | continue; |
| | | } |
| | | //判断reserveRecordId为空则为第一条记录,默认加上昵称和灯谜是 |
| | | if (reserveRecordId.equals(0L)) { |
| | | reserveRecordId = userAnswers.getReserveRecordId(); |
| | | userData.add(userAnswers.getNickName()); |
| | | userData.add(DateUtils.format(userAnswers.getTime(), DateUtils.ymdhms_format)); |
| | | } |
| | | //根据reserveRecordId判断是否是第二条填报记录 |
| | | if (!reserveRecordId.equals(userAnswers.getReserveRecordId())) { |
| | | reserveSubId = 0L; |
| | | |
| | | userData = new ArrayList<>(); |
| | | reserveRecordId = userAnswers.getReserveRecordId(); |
| | | userData.add(userAnswers.getNickName()); |
| | | userData.add(DateUtils.format(userAnswers.getTime(), DateUtils.ymdhms_format)); |
| | | if(StringUtils.isNotEmpty(userAnswers.getAnswerContent())){ |
| | | userData.add(userAnswers.getAnswerContent()); |
| | | }else{ |
| | | userData.add(" "); |
| | | } |
| | | }else{ |
| | | if(reserveSubId.equals(0L)){ |
| | | reserveSubId = userAnswers.getReserveSubId(); |
| | | } |
| | | |
| | | if(!reserveSubId.equals(userAnswers.getReserveSubId())){ |
| | | reserveSubId = userAnswers.getReserveSubId(); |
| | | |
| | | //判断当前的组件类型是否是图片上传,导出时需要导出图片 |
| | | if(userAnswers.getOptionType().equals(11)){ |
| | | reserveSubId = userAnswers.getReserveSubId(); |
| | | try { |
| | | userData.add(new URL(userAnswers.getAnswerContent())); |
| | | }catch (Exception e){ |
| | | userData.add(" "); |
| | | log.error("导出转换图片失败!"); |
| | | } |
| | | continue; |
| | | } |
| | | sb.append(userAnswers.getAnswerContent()==null?"无":userAnswers.getAnswerContent() + ","); |
| | | String answer = sb.toString(); |
| | | userData.add(answer.substring(0, answer.length() - 1)); |
| | | sb = new StringBuffer(); |
| | | }else{ |
| | | //判断当前的组件类型是否是图片上传,导出时需要导出图片 |
| | | if(userAnswers.getOptionType().equals(11)){ |
| | | reserveSubId = userAnswers.getReserveSubId(); |
| | | try { |
| | | userData.add(new URL(userAnswers.getAnswerContent())); |
| | | }catch (Exception e){ |
| | | userData.add(" "); |
| | | log.error("导出转换图片失败!"); |
| | | } |
| | | continue; |
| | | } |
| | | sb.append(userAnswers.getAnswerContent()==null?"无":userAnswers.getAnswerContent() + ","); |
| | | String answer = sb.toString(); |
| | | userData.add(answer.substring(0, answer.length() - 1)); |
| | | sb = new StringBuffer(); |
| | | } |
| | | } |
| | | } |
| | | resultList.add(userData); |
| | | } |
| | | return resultList; |
| | | } |
| | | |
| | | } |
| | |
| | | * @return 删除结果 |
| | | */ |
| | | @PostMapping("/special/delete") |
| | | public R deleteSpecialInputUser(@RequestParam(value = "id") Long id) { |
| | | return comMngPopulationService.deleteSpecialInputUser(id); |
| | | public R deleteSpecialInputUser(@RequestParam(value = "id") Long id,@RequestParam(value = "communityId") Long communityId) { |
| | | return comMngPopulationService.deleteSpecialInputUser(id,communityId); |
| | | } |
| | | |
| | | /** |
| | |
| | | package com.panzhihua.service_community.api; |
| | | |
| | | import java.time.Instant; |
| | | import java.util.List; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | */ |
| | | @PostMapping("/merchant/add") |
| | | public R addMerchant(@RequestBody ConvenientMerchantDTO convenientMerchantDTO) { |
| | | log.error("catTimeStamp进入service_community", Instant.now().toEpochMilli()); |
| | | return convenientMerchantService.addMerchant(convenientMerchantDTO); |
| | | } |
| | | |
| | |
| | | * @return |
| | | */ |
| | | List<ConvenientConsultationStatisticsVO> selectSumForConsultationNum(); |
| | | |
| | | /** |
| | | * 获取商家总咨询量 |
| | | * @param merchantId |
| | | * @return |
| | | */ |
| | | int selectTotalConsultationVolume(@Param("merchantId") Long merchantId); |
| | | } |
| | |
| | | * @return |
| | | */ |
| | | List<ConvenientViewStatisticsVO> selectSumForViewNum(); |
| | | |
| | | /** |
| | | * 获取商家总浏览量 |
| | | * @param merchantId |
| | | * @return |
| | | */ |
| | | int selectTotalViewNum(@Param("merchantId") Long merchantId); |
| | | } |
| | |
| | | /** |
| | | * 标签集合(多个标签以,隔开) |
| | | */ |
| | | @TableField(updateStrategy = FieldStrategy.IGNORED) |
| | | private String label; |
| | | |
| | | /** |
| | |
| | | /** |
| | | * 标签集合(多个标签以,隔开) |
| | | */ |
| | | @TableField(fill = FieldFill.UPDATE) |
| | | @TableField(fill = FieldFill.UPDATE,updateStrategy = FieldStrategy.IGNORED) |
| | | private String label; |
| | | |
| | | /** |
| | |
| | | */ |
| | | private Boolean onShelf; |
| | | /** |
| | | * 上架时间 |
| | | */ |
| | | private Date onShelfAt; |
| | | /** |
| | | * 产品介绍 |
| | | */ |
| | | private String introduction; |
| | |
| | | * 特殊群体id |
| | | * @return 删除结果 |
| | | */ |
| | | R deleteSpecialInputUser(Long id); |
| | | R deleteSpecialInputUser(Long id,Long communityId); |
| | | |
| | | /** |
| | | * 基础数据》特殊群体》分页查询标签列表 |
| | |
| | | BeanUtils.copyProperties(addClusterAdminDto,organizationDO); |
| | | organizationDO.setCreateAt(new Date()); |
| | | if(this.baseMapper.insert(organizationDO) > 0){ |
| | | return R.ok(); |
| | | return R.ok("新增成功"); |
| | | } |
| | | return R.fail(); |
| | | return R.fail("新增失败"); |
| | | } |
| | | |
| | | /** |
| | |
| | | BeanUtils.copyProperties(editClusterAdminDto,organizationDO); |
| | | organizationDO.setUpdateAt(new Date()); |
| | | if(this.baseMapper.updateById(organizationDO) > 0){ |
| | | return R.ok(); |
| | | return R.ok("编辑成功"); |
| | | } |
| | | return R.fail(); |
| | | return R.fail("编辑失败"); |
| | | } |
| | | |
| | | /** |
| | |
| | | organizationDO.setIsDel(ComClusterOrganizationDO.isOk.yes); |
| | | organizationDO.setUpdateAt(new Date()); |
| | | if(this.baseMapper.updateById(organizationDO) > 0){ |
| | | return R.ok(); |
| | | return R.ok("删除成功"); |
| | | } |
| | | return R.fail(); |
| | | return R.fail("删除失败"); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return 删除结果 |
| | | */ |
| | | @Override |
| | | public R deleteSpecialInputUser(Long id) { |
| | | public R deleteSpecialInputUser(Long id,Long communityId) { |
| | | // 查询特殊群体人员 |
| | | ComMngPopulationDO populationDO = this.baseMapper.selectById(id); |
| | | if (populationDO == null) { |
| | | return R.fail("未查询到该记录"); |
| | | } |
| | | populationDO.setLabel(null); |
| | | |
| | | // 清理社区与人口关联信息的label信息 |
| | | List<ComMngPopulationCommunityTagsDO> communityTagsDOList = comMngPopulationCommunityTagsDAO.selectList(new QueryWrapper<ComMngPopulationCommunityTagsDO>() |
| | | .lambda().eq(ComMngPopulationCommunityTagsDO::getPopulationId,id).eq(ComMngPopulationCommunityTagsDO::getCommunityId,communityId)); |
| | | if(communityTagsDOList != null && communityTagsDOList.size() > 0){ |
| | | communityTagsDOList.forEach(communityTags -> { |
| | | communityTags.setLabel(null); |
| | | comMngPopulationCommunityTagsDAO.updateById(communityTags); |
| | | }); |
| | | } |
| | | |
| | | if (this.baseMapper.updateById(populationDO) > 0) { |
| | | return R.ok(); |
| | | } else { |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import cn.hutool.core.util.IdcardUtil; |
| | | import com.panzhihua.common.utlis.WxUtil; |
| | | import com.panzhihua.common.utlis.WxXCXTempSend; |
| | | import com.panzhihua.service_community.dao.ComActActSignDAO; |
| | |
| | | public R detailPensionAuthRecords(Long authRecordId) { |
| | | ComPensionAuthRecordVO comPensionAuthRecordVO = comPensionAuthRecordDAO.detailPensionAuthRecords(authRecordId); |
| | | comPensionAuthRecordVO.setNextIds(comPensionAuthRecordDAO.getNextIds(comPensionAuthRecordVO.getCommunityId(),authRecordId)); |
| | | try { |
| | | comPensionAuthRecordVO.setAge(IdcardUtil.getAgeByIdCard(comPensionAuthRecordVO.getIdCard())); |
| | | }catch (Exception e){ |
| | | log.error("身份证转换失败"); |
| | | } |
| | | return R.ok(comPensionAuthRecordVO); |
| | | } |
| | | |
| | |
| | | import static org.apache.commons.lang3.StringUtils.isNotBlank; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.Instant; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | * @date: 2021/09/16 16:14 |
| | | */ |
| | | @Service |
| | | @Slf4j |
| | | public class ConvenientMerchantServiceImpl extends ServiceImpl<ConvenientMerchantDAO, ConvenientMerchantDO> implements ConvenientMerchantService { |
| | | |
| | | @Resource |
| | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R addMerchant(ConvenientMerchantDTO convenientMerchantDTO) { |
| | | log.error("catTimeStamp开始执行addMerchant", Instant.now().toEpochMilli()); |
| | | ComActDO comActDO = comActDAO.selectById(convenientMerchantDTO.getCommunityId()); |
| | | ConvenientMerchantDO convenientMerchantDO = new ConvenientMerchantDO(); |
| | | BeanUtils.copyProperties(convenientMerchantDTO, convenientMerchantDO); |
| | |
| | | }); |
| | | } |
| | | } |
| | | log.error("catTimeStamp商家创建完成开始添加用户", Instant.now().toEpochMilli()); |
| | | //添加user |
| | | R addUserResult = userService.addConvenientMerchantUser(convenientMerchantDTO); |
| | | if (R.isOk(addUserResult)) { |
| | |
| | | } else { |
| | | throw new ServiceException("406", addUserResult.getMsg()); |
| | | } |
| | | log.error("catTimeStamp全部完成", Instant.now().toEpochMilli()); |
| | | return R.ok(); |
| | | } |
| | | |
| | |
| | | R result = userService.disableOrEnableMerchantUsers(disableOrEnableConvenientMerchantDTO); |
| | | int type = disableOrEnableConvenientMerchantDTO.getType().intValue(); |
| | | if (type == 2) { |
| | | this.baseMapper.batchUpdateBusinessStatus(convenientMerchantDOList, 2); |
| | | this.baseMapper.batchUpdateBusinessStatus(convenientMerchantDOList, 0); |
| | | } |
| | | if (R.isOk(result)) { |
| | | return R.ok(); |
| | |
| | | SimpleDateFormat dayFormat = new SimpleDateFormat("yyyy-MM-dd"); |
| | | String moth = mothFormat.format(nowDate); |
| | | String day = dayFormat.format(nowDate); |
| | | int consultationCount = convenientConsultationStatisticsDAO.selectCount(new QueryWrapper<ConvenientConsultationStatisticsDO>() |
| | | .lambda().eq(ConvenientConsultationStatisticsDO::getMerchantId, merchantId)); |
| | | int consultationCount = convenientConsultationStatisticsDAO.selectTotalConsultationVolume(merchantId); |
| | | int monthConsultationVolume = convenientConsultationStatisticsDAO.selectMonthConsultationVolume(merchantId, moth); |
| | | int dayConsultationVolume = convenientConsultationStatisticsDAO.selectDayConsultationVolume(merchantId, day); |
| | | Integer viewCount = convenientViewStatisticsDAO.selectCount(new QueryWrapper<ConvenientViewStatisticsDO>() |
| | | .lambda().eq(ConvenientViewStatisticsDO::getMerchantId, merchantId)); |
| | | Integer viewCount = convenientViewStatisticsDAO.selectTotalViewNum(merchantId); |
| | | int monthViewNum = convenientViewStatisticsDAO.selectMonthViewNum(merchantId, moth); |
| | | int dayViewNum = convenientViewStatisticsDAO.selectDayViewNum(merchantId, day); |
| | | convenientMerchantVO.setConsultationVolume(consultationCount); |
| | |
| | | ConvenientProductDO convenientProductDO = new ConvenientProductDO(); |
| | | BeanUtils.copyProperties(convenientProductDTO, convenientProductDO); |
| | | Date nowDate = new Date(); |
| | | if (convenientProductDTO.getOnShelf()) { |
| | | convenientProductDO.setOnShelfAt(nowDate); |
| | | } |
| | | convenientProductDO.setCreatedAt(nowDate); |
| | | this.baseMapper.insert(convenientProductDO); |
| | | Long productId = convenientProductDO.getId(); |
| | |
| | | Long productId = convenientProductDTO.getId(); |
| | | Long updatedBy = convenientProductDTO.getUpdatedBy(); |
| | | ConvenientProductDO convenientProductDO = this.baseMapper.selectById(productId); |
| | | Boolean isOnShelf = convenientProductDO.getOnShelf(); |
| | | if (isNull(convenientProductDO)) { |
| | | return R.fail("产品不存在"); |
| | | } |
| | | BeanUtils.copyProperties(convenientProductDTO, convenientProductDO); |
| | | Date nowDate = new Date(); |
| | | if (!isOnShelf && convenientProductDTO.getOnShelf()) { |
| | | convenientProductDO.setOnShelfAt(nowDate); |
| | | } |
| | | convenientProductDO.setUpdatedBy(updatedBy); |
| | | this.baseMapper.updateById(convenientProductDO); |
| | | List<ConvenientProductSpecificationDTO> productSpecificationDTOList = convenientProductDTO.getProductSpecificationDTOList(); |
| | | List<Long> notNeedDelIds = productSpecificationDTOList.stream().filter(specificationDTO -> nonNull(specificationDTO.getId())) |
| | | .map(ConvenientProductSpecificationDTO::getId).collect(Collectors.toList()); |
| | | Date nowDate = new Date(); |
| | | productSpecificationDTOList.forEach(specificationDTO -> { |
| | | Long specificationId = specificationDTO.getId(); |
| | | if (isNull(specificationId)) { |
| | |
| | | SELECT |
| | | count( id ) |
| | | FROM |
| | | com_pb_member AS su |
| | | WHERE |
| | | community_id = #{communityId} |
| | | AND user_id NOT IN ( SELECT user_id FROM com_act_questnaire_user_answer WHERE questnaire_id = #{questId} )) AS noPartymemberCount, |
| | | ( |
| | | SELECT id FROM com_pb_member AS su WHERE community_id = #{communityId} AND user_id IS NULL UNION ALL |
| | | SELECT id FROM com_pb_member AS su WHERE community_id = #{communityId} AND user_id IS NOT NULL |
| | | AND user_id NOT IN ( SELECT user_id FROM com_act_questnaire_user_answer WHERE questnaire_id = #{questId} ) |
| | | ) AS member) AS noPartymemberCount, |
| | | (select count(user_id) from sys_user where community_id = 2 and type = 1) as userCount |
| | | FROM |
| | | com_act_questnaire_user_answer AS caqua |
| | |
| | | SELECT |
| | | carr.id, |
| | | su.nick_name, |
| | | su1.`name` as handleName, |
| | | carr.`name`, |
| | | carr.phone, |
| | | carr.reserve_time, |
| | |
| | | FROM |
| | | com_act_reserve_record AS carr |
| | | LEFT JOIN sys_user AS su ON su.user_id = carr.user_id |
| | | LEFT JOIN sys_user AS su1 ON su1.user_id = carr.handle_id |
| | | where carr.status = 2 and carr.`type` = 1 and carr.reserve_id = #{pageMakeDTO.reserveId} |
| | | <if test="pageMakeDTO.startTime != null and pageMakeDTO.startTime != """> |
| | | AND carr.reserve_time <![CDATA[ >= ]]> #{pageMakeDTO.startTime} |
| | |
| | | SELECT |
| | | carr.id, |
| | | su.nick_name, |
| | | su1.`name` as handleName, |
| | | carr.`name`, |
| | | carr.phone, |
| | | carr.reserve_time, |
| | |
| | | FROM |
| | | com_act_reserve_record AS carr |
| | | LEFT JOIN sys_user AS su ON su.user_id = carr.user_id |
| | | LEFT JOIN sys_user AS su1 ON su1.user_id = carr.handle_id |
| | | where carr.id = #{reserveRecordId} |
| | | </select> |
| | | |
| | |
| | | SELECT |
| | | carr.id, |
| | | su.nick_name, |
| | | su.`name` as handleName, |
| | | carr.`name`, |
| | | carr.phone, |
| | | carr.reserve_time, |
| | |
| | | FROM |
| | | com_act_reserve_record AS carr |
| | | LEFT JOIN sys_user AS su ON su.user_id = carr.user_id |
| | | LEFT JOIN sys_user AS su1 ON su1.user_id = carr.handle_id |
| | | where carr.status = 2 and carr.`type` = 1 and carr.reserve_id = #{pageMakeDTO.reserveId} |
| | | <if test="pageMakeDTO.startTime != null and pageMakeDTO.startTime != """> |
| | | AND carr.reserve_time <![CDATA[ >= ]]> #{pageMakeDTO.startTime} |
| | |
| | | SELECT |
| | | carr.id, |
| | | su.nick_name, |
| | | su1.`name` as handleName, |
| | | carr.`name`, |
| | | carr.phone, |
| | | carr.reserve_time, |
| | |
| | | FROM |
| | | com_act_reserve_record AS carr |
| | | LEFT JOIN sys_user AS su ON su.user_id = carr.user_id |
| | | LEFT JOIN sys_user AS su1 ON su1.user_id = carr.handle_id |
| | | LEFT JOIN com_act_reserve AS car ON car.id = carr.reserve_id |
| | | WHERE |
| | | carr.`type` = 1 |
| | |
| | | SELECT merchant_id, SUM(consultation_volume) AS totalConsultationNum |
| | | FROM com_convenient_consultation_statistics GROUP BY merchant_id |
| | | </select> |
| | | <select id="selectTotalConsultationVolume" resultType="java.lang.Integer"> |
| | | SELECT IF(SUM(consultation_volume) IS NULL,0,SUM(consultation_volume)) |
| | | FROM com_convenient_consultation_statistics |
| | | WHERE merchant_id = #{merchantId} |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | <id column="category_id" property="categoryId" /> |
| | | <id column="merchant_id" property="merchantId" /> |
| | | <id column="on_shelf" property="onShelf" /> |
| | | <id column="on_shelf_at" property="onShelfAt" /> |
| | | <id column="introduction" property="introduction" /> |
| | | <id column="is_del" property="isDel" /> |
| | | <id column="view_num" property="viewNum" /> |
| | |
| | | |
| | | <!-- 通用查询结果列 --> |
| | | <sql id="Base_Column_List"> |
| | | id,`name`,category_id,merchant_id,on_shelf,introduction,is_del,view_num,created_at,created_by,updated_at,updated_by |
| | | id,`name`,category_id,merchant_id,on_shelf,on_shelf_at,introduction,is_del,view_num,created_at,created_by,updated_at,updated_by |
| | | </sql> |
| | | <update id="batchDeleteByIds"> |
| | | UPDATE com_convenient_products SET is_del = 1 WHERE id IN |
| | |
| | | </foreach> |
| | | </update> |
| | | <update id="batchOnShelfOrOffShelfByIds"> |
| | | UPDATE com_convenient_products SET on_shelf = #{saleStatus}, updated_by = #{updatedBy} WHERE id IN |
| | | UPDATE com_convenient_products SET on_shelf = #{saleStatus}, |
| | | <if test="saleStatus"> |
| | | on_shelf_at = NOW(), |
| | | </if> |
| | | updated_by = #{updatedBy} WHERE id IN |
| | | <foreach collection="needDealIds" open="(" separator="," close=")" index="index" item="item"> |
| | | #{item} |
| | | </foreach> |
| | |
| | | SELECT merchant_id, SUM(view_num) AS totalViewNum |
| | | FROM com_convenient_view_statistics GROUP BY merchant_id |
| | | </select> |
| | | <select id="selectTotalViewNum" resultType="java.lang.Integer"> |
| | | SELECT IF(SUM(view_num) IS NULL,0,SUM(view_num)) |
| | | FROM com_convenient_view_statistics |
| | | WHERE merchant_id = #{merchantId} |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | |
| | | if (eventMapper.insert(eventDO) == 1) { |
| | | // 如果是特殊人群,则新增特殊人群与事件关系 |
| | | if (commonEventAddDTO.getEventType().equals(6)) { |
| | | if (commonEventAddDTO.getEventType().equals(6) |
| | | && commonEventAddDTO.getPopulationIds() != null |
| | | && commonEventAddDTO.getPopulationIds().size() > 0) { |
| | | if (commonEventAddDTO.getPopulationIds() != null && commonEventAddDTO.getPopulationIds().size() > 0) { |
| | | List<EventSpecialCrowdRecordDO> crowdRecordList = new ArrayList<>(); |
| | | commonEventAddDTO.getPopulationIds().forEach(populationId -> { |
| | |
| | | if (!ObjectUtils.isEmpty(sysRoleMenuDOS)) { |
| | | List<Long> longs = |
| | | sysRoleMenuDOS.stream().map(sysRoleMenuDO -> sysRoleMenuDO.getMenuId()).collect(Collectors.toList()); |
| | | return R.ok(longs); |
| | | List<SysMenuDO> sysMenuDOList=this.sysMenuDAO.selectList(new QueryWrapper<SysMenuDO>().lambda().in(SysMenuDO::getMenuId,longs).eq(SysMenuDO::getParentId,0)); |
| | | sysMenuDOList.forEach(sysMenuDO -> { |
| | | List<SysMenuDO> sysMenuDOS=this.sysMenuDAO.selectList(new QueryWrapper<SysMenuDO>().lambda().in(SysMenuDO::getMenuId,longs).eq(SysMenuDO::getParentId,sysMenuDO.getMenuId())); |
| | | sysMenuDOS.forEach(sysMenuDO1 -> { |
| | | List<SysMenuDO> sysMenuDOS1=this.sysMenuDAO.selectList(new QueryWrapper<SysMenuDO>().lambda().in(SysMenuDO::getMenuId,longs).eq(SysMenuDO::getParentId,sysMenuDO1.getMenuId())); |
| | | if(!sysMenuDOS1.isEmpty()){ |
| | | longs.remove(sysMenuDO1.getMenuId()); |
| | | } |
| | | }); |
| | | if(!sysMenuDOS.isEmpty()){ |
| | | longs.remove(sysMenuDO.getMenuId()); |
| | | } |
| | | }); |
| | | return R.ok(longs); |
| | | } |
| | | return R.fail(); |
| | | } |
| | |
| | | import static java.util.Objects.isNull; |
| | | import static java.util.Objects.nonNull; |
| | | |
| | | import java.time.Instant; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R addGridUser(EventGridMemberAddDTO eventGridMemberAddDTO) { |
| | | |
| | | //todo 网格 |
| | | SysRoleDO gridMemberDefaultRole = roleDAO.selectOne( |
| | | new QueryWrapper<SysRoleDO>().lambda().eq(SysRoleDO::getRoleKey, Constants.GRID_DEFAULT_ROLE_KEY)); |
| | | if (gridMemberDefaultRole == null) { |
| | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R addConvenientMerchantUser(ConvenientMerchantDTO convenientMerchantDTO) { |
| | | // todo 便民 |
| | | log.error("catTimeStamp进入addConvenientMerchantUser", Instant.now().toEpochMilli()); |
| | | SysUserDO sysUserDO = new SysUserDO(); |
| | | Long communityId = 0L; |
| | | // 新增社区高级管理员角色 |
| | | SysRoleDO sysRoleDO = new SysRoleDO(); |
| | | sysRoleDO.setCommunityId(0L); |
| | | sysRoleDO.setCommunityId(communityId); |
| | | sysRoleDO.setRoleName(convenientMerchantDTO.getName()); |
| | | sysRoleDO.setRoleKey(Constants.CONVENIENT_MERCHANT_ROLE_KEY + convenientMerchantDTO.getAccount()); |
| | | sysRoleDO.setRoleSort(0); |
| | |
| | | if (e.getMessage().contains("unique_role_name_community_id")) { |
| | | return R.fail("商家名称已被占用"); |
| | | } else { |
| | | return R.fail("建立商家角色失败"); |
| | | return R.fail("建立商家角色失败,商家名称可能已被占用!"); |
| | | } |
| | | } |
| | | log.error("catTimeStamp-SysRoleDO创建完成", Instant.now().toEpochMilli()); |
| | | // 新角色设置所有权限 |
| | | MenuRoleVO menuRoleVO = new MenuRoleVO(); |
| | | menuRoleVO.setIsAll(1); |
| | | menuRoleVO.setCommunityId(communityId); |
| | | menuRoleVO.setRoleId(sysRoleDO.getRoleId()); |
| | | this.putMenuRole(menuRoleVO); |
| | | |
| | | log.error("catTimeStamp-MenuRoleVO创建完成", Instant.now().toEpochMilli()); |
| | | |
| | | // sys_user 表 |
| | | String encode = new BCryptPasswordEncoder().encode(convenientMerchantDTO.getPassword()); |
| | |
| | | sysUserDO.setPassword(encode); |
| | | try { |
| | | userDao.insert(sysUserDO); |
| | | log.error("catTimeStamp-sysUserDO创建完成", Instant.now().toEpochMilli()); |
| | | return R.ok(sysUserDO.getUserId()); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |