Merge branch 'master' of http://8.140.179.55:20000/r/pipIrr-SV
| | |
| | | */ |
| | | List<Map<String, Object>> getRoleNamesByUserId(@Param("userId") Long userId); |
| | | |
| | | /** |
| | | * 得到所有手机号(登录账号) |
| | | * @return |
| | | */ |
| | | List<String> getPhones(); |
| | | } |
| New file |
| | |
| | | package com.dy.pipIrrGlobal.daoPr; |
| | | |
| | | import com.dy.pipIrrGlobal.pojoPr.PrNetworkCoordinates; |
| | | import com.dy.pipIrrGlobal.voPr.VoNetworkCoordinates; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-08-27 17:23 |
| | | * @LastEditTime 2024-08-27 17:23 |
| | | * @Description |
| | | */ |
| | | public interface PrNetworkCoordinatesMapper { |
| | | int deleteByPrimaryKey(Long id); |
| | | |
| | | int insert(PrNetworkCoordinates record); |
| | | |
| | | int insertSelective(PrNetworkCoordinates record); |
| | | |
| | | PrNetworkCoordinates selectByPrimaryKey(Long id); |
| | | |
| | | int updateByPrimaryKeySelective(PrNetworkCoordinates record); |
| | | |
| | | int updateByPrimaryKey(PrNetworkCoordinates record); |
| | | |
| | | /** |
| | | * 清除全部管网坐标 |
| | | */ |
| | | void clearCoordinates(); |
| | | |
| | | /** |
| | | * 根据管网ID获取管网坐标列表 |
| | | * @param networkId |
| | | * @return |
| | | */ |
| | | List<VoNetworkCoordinates> getCoordinatesByNetworkId(Long networkId); |
| | | |
| | | } |
| New file |
| | |
| | | package com.dy.pipIrrGlobal.daoPr; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.dy.pipIrrGlobal.pojoPr.PrWaterNetwork; |
| | | import com.dy.pipIrrGlobal.voPr.VoNetwork; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-08-27 17:14 |
| | | * @LastEditTime 2024-08-27 17:14 |
| | | * @Description |
| | | */ |
| | | |
| | | @Mapper |
| | | public interface PrWaterNetworkMapper extends BaseMapper<PrWaterNetwork> { |
| | | int deleteByPrimaryKey(Long id); |
| | | |
| | | int insert(PrWaterNetwork record); |
| | | |
| | | int insertSelective(PrWaterNetwork record); |
| | | |
| | | PrWaterNetwork selectByPrimaryKey(Long id); |
| | | |
| | | int updateByPrimaryKeySelective(PrWaterNetwork record); |
| | | |
| | | int updateByPrimaryKey(PrWaterNetwork record); |
| | | |
| | | /** |
| | | * 清除全部管网 |
| | | */ |
| | | void clearNetworks(); |
| | | |
| | | /** |
| | | * 获取全部管网 |
| | | * @return |
| | | */ |
| | | List<VoNetwork> getAllNewworks(); |
| | | |
| | | } |
| New file |
| | |
| | | package com.dy.pipIrrGlobal.excel; |
| | | |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | |
| | | import java.io.UnsupportedEncodingException; |
| | | import java.net.URLEncoder; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-08-26 10:28 |
| | | * @LastEditTime 2024-08-26 10:28 |
| | | * @Description 设置excel下载响应头属性 |
| | | */ |
| | | public class ExcelUtil { |
| | | public static void setExcelRespProp(HttpServletResponse response, String rawFileName) throws UnsupportedEncodingException { |
| | | String fileName = URLEncoder.encode(rawFileName, "UTF-8").replaceAll("\\+", "%20"); |
| | | response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); |
| | | response.setCharacterEncoding("utf-8"); |
| | | response.setHeader("Content-Disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx"); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.dy.pipIrrGlobal.excel; |
| | | |
| | | import com.alibaba.excel.metadata.Head; |
| | | import com.alibaba.excel.metadata.data.WriteCellData; |
| | | import com.alibaba.excel.write.handler.context.CellWriteHandlerContext; |
| | | import com.alibaba.excel.write.metadata.holder.WriteSheetHolder; |
| | | import com.alibaba.excel.write.metadata.holder.WriteTableHolder; |
| | | import com.alibaba.excel.write.metadata.style.WriteCellStyle; |
| | | import com.alibaba.excel.write.metadata.style.WriteFont; |
| | | import com.alibaba.excel.write.style.AbstractVerticalCellStyleStrategy; |
| | | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | | import org.apache.poi.ss.usermodel.*; |
| | | import org.apache.poi.xssf.usermodel.DefaultIndexedColorMap; |
| | | import org.apache.poi.xssf.usermodel.XSSFCellStyle; |
| | | import org.apache.poi.xssf.usermodel.XSSFColor; |
| | | import org.springframework.util.PropertyPlaceholderHelper; |
| | | |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import java.util.Properties; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-08-26 14:18 |
| | | * @LastEditTime 2024-08-26 14:18 |
| | | * @Description |
| | | */ |
| | | |
| | | public class ReportExportCellWriteHandler extends AbstractVerticalCellStyleStrategy { |
| | | private String title; |
| | | |
| | | PropertyPlaceholderHelper propertyPlaceholderHelper = new PropertyPlaceholderHelper("${", "}"); |
| | | |
| | | public ReportExportCellWriteHandler(String title) { |
| | | this.title = title; |
| | | } |
| | | |
| | | // 动态导入标题 |
| | | @Override |
| | | public void beforeCellCreate(WriteSheetHolder writeSheetHolder, WriteTableHolder writeTableHolder, |
| | | Row row, Head head, Integer integer, Integer integer1, Boolean aBoolean) { |
| | | if (head != null) { |
| | | List<String> headNameList = head.getHeadNameList(); |
| | | if (CollectionUtils.isNotEmpty(headNameList)) { |
| | | Properties properties = new Properties(); |
| | | properties.setProperty("title", title); |
| | | headNameList.replaceAll(value -> propertyPlaceholderHelper.replacePlaceholders(value, properties)); |
| | | } |
| | | } |
| | | } |
| | | |
| | | // 设置标题样式,包含字体、背景 |
| | | @Override |
| | | protected void setHeadCellStyle(CellWriteHandlerContext context) { |
| | | // 获取和创建CellStyle |
| | | WriteCellData<?> cellData = context.getFirstCellData(); |
| | | CellStyle originCellStyle = cellData.getOriginCellStyle(); |
| | | Cell cell = context.getCell(); |
| | | |
| | | if (Objects.isNull(originCellStyle)) { |
| | | originCellStyle = context.getWriteWorkbookHolder().getWorkbook().createCellStyle(); |
| | | } |
| | | |
| | | ((XSSFCellStyle) originCellStyle).setFillForegroundColor(new XSSFColor(new java.awt.Color(255, 255, 255), new DefaultIndexedColorMap())); |
| | | |
| | | // 设置指定列背景色 |
| | | //if(cell.getColumnIndex() == 10 |
| | | //) { |
| | | // ((XSSFCellStyle) originCellStyle).setFillForegroundColor(new XSSFColor(new java.awt.Color(237, 237, 237), new DefaultIndexedColorMap())); |
| | | //} |
| | | |
| | | // 设置背景颜色 |
| | | originCellStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND); |
| | | // 由于在FillStyleCellWriteHandler,会把OriginCellStyle和WriteCellStyle合并,会以WriteCellStyle样式为主,所有必须把WriteCellStyle设置的背景色清空 |
| | | // 具体合并规则看WriteWorkbookHolder.createCellStyle方法 |
| | | WriteCellStyle writeCellStyle = cellData.getWriteCellStyle(); |
| | | writeCellStyle.setFillForegroundColor(null); |
| | | // 必须设置OriginCellStyle |
| | | cellData.setOriginCellStyle(originCellStyle); |
| | | |
| | | WriteFont headWriteFont = new WriteFont(); |
| | | if (cell.getRowIndex() == 0) { |
| | | headWriteFont.setFontHeightInPoints((short)14); |
| | | headWriteFont.setFontName("Arial"); |
| | | headWriteFont.setBold(true); |
| | | }else if (cell.getRowIndex() == 1) { |
| | | headWriteFont.setFontHeightInPoints((short)12); |
| | | headWriteFont.setFontName("Arial"); |
| | | headWriteFont.setBold(false); |
| | | } |
| | | |
| | | cellData.getWriteCellStyle().setWriteFont(headWriteFont); |
| | | } |
| | | |
| | | // 设置内容公示、内容字体样式、背景样式 |
| | | @Override |
| | | protected void setContentCellStyle(CellWriteHandlerContext context) { |
| | | |
| | | // 获取和创建CellStyle |
| | | WriteCellData<?> cellData = context.getFirstCellData(); |
| | | CellStyle originCellStyle = cellData.getOriginCellStyle(); |
| | | Cell cell = context.getCell(); |
| | | |
| | | if (Objects.isNull(originCellStyle)) { |
| | | originCellStyle = context.getWriteWorkbookHolder().getWorkbook().createCellStyle(); |
| | | } |
| | | // 设置背景颜色 |
| | | ((XSSFCellStyle) originCellStyle).setFillForegroundColor(new XSSFColor(new java.awt.Color(255, 192, 0), new DefaultIndexedColorMap())); |
| | | //System.out.println("Go to row: " + context.getCell().getRowIndex() + ", column: " + context.getCell().getColumnIndex()); |
| | | |
| | | if (cell.getRowIndex() >= 2){ |
| | | ((XSSFCellStyle) originCellStyle).setFillForegroundColor(new XSSFColor(new java.awt.Color(237, 237, 237), new DefaultIndexedColorMap())); |
| | | // 票面总价 |
| | | //if (cell.getColumnIndex() == 10){ |
| | | // int actualCellRowNum = context.getCell().getRowIndex() + 1; |
| | | // context.getCell().setCellFormula("I" + actualCellRowNum +"+J" + actualCellRowNum); |
| | | // System.out.println("第" + context.getCell().getRowIndex() + "行,第" + context.getCell().getColumnIndex() + "票面总价写入公式完成"); |
| | | //}else if (cell.getColumnIndex() == 12){ |
| | | // // 支付票款 |
| | | // int actualCellRowNum = context.getCell().getRowIndex() + 1; |
| | | // context.getCell().setCellFormula("K" + actualCellRowNum +"-L" + actualCellRowNum); |
| | | // System.out.println("第" + context.getCell().getRowIndex() + "行,第" + context.getCell().getColumnIndex() + "支付票款写入公式完成"); |
| | | //}else if (cell.getColumnIndex() == 15){ |
| | | // // 支付总额 |
| | | // int actualCellRowNum = context.getCell().getRowIndex() + 1; |
| | | // context.getCell().setCellFormula("M" + actualCellRowNum +"+N" + actualCellRowNum +"+O" + actualCellRowNum); |
| | | // System.out.println("第" + context.getCell().getRowIndex() + "行,第" + context.getCell().getColumnIndex() + "支付总额写入公式完成"); |
| | | //}else if (cell.getColumnIndex() == 17){ |
| | | // // 实际利润 |
| | | // int actualCellRowNum = context.getCell().getRowIndex() + 1; |
| | | // context.getCell().setCellFormula("L" + actualCellRowNum +"+Q" + actualCellRowNum); |
| | | // System.out.println("第" + context.getCell().getRowIndex() + "行,第" + context.getCell().getColumnIndex() + "实际利润写入公式完成"); |
| | | //}else if (cell.getColumnIndex() == 18){ |
| | | // // 应收款 |
| | | // int actualCellRowNum = context.getCell().getRowIndex() + 1; |
| | | // context.getCell().setCellFormula("P" + actualCellRowNum +"+R" + actualCellRowNum); |
| | | // System.out.println("第" + context.getCell().getRowIndex() + "行,第" + context.getCell().getColumnIndex() + "应收款写入公式完成"); |
| | | //}else if (cell.getColumnIndex() == 20){ |
| | | // // 未收款 |
| | | // int actualCellRowNum = context.getCell().getRowIndex() + 1; |
| | | // context.getCell().setCellFormula("S" + actualCellRowNum +"-T" + actualCellRowNum); |
| | | // System.out.println("第" + context.getCell().getRowIndex() + "行,第" + context.getCell().getColumnIndex() + "未收款写入公式完成"); |
| | | //}else if (cell.getColumnIndex() >= 2){ |
| | | // ((XSSFCellStyle) originCellStyle).setFillForegroundColor(new XSSFColor(new java.awt.Color(189, 215, 238), new DefaultIndexedColorMap())); |
| | | //}else if (cell.getColumnIndex() < 2){ |
| | | // ((XSSFCellStyle) originCellStyle).setFillForegroundColor(new XSSFColor(new java.awt.Color(255, 192, 0), new DefaultIndexedColorMap())); |
| | | //} |
| | | } |
| | | |
| | | originCellStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND); |
| | | originCellStyle.setBorderLeft(BorderStyle.THIN); //左边框线 |
| | | originCellStyle.setBorderTop(BorderStyle.THIN); //顶部框线 |
| | | originCellStyle.setBorderRight(BorderStyle.THIN); //右边框线 |
| | | originCellStyle.setBorderBottom(BorderStyle.THIN); //底部框线 |
| | | // 由于在FillStyleCellWriteHandler,会把OriginCellStyle和WriteCellStyle合并,会以WriteCellStyle样式为主,所有必须把WriteCellStyle设置的背景色清空 |
| | | // 具体合并规则看WriteWorkbookHolder.createCellStyle方法 |
| | | WriteCellStyle writeCellStyle = cellData.getWriteCellStyle(); |
| | | writeCellStyle.setFillForegroundColor(null); |
| | | writeCellStyle.setHorizontalAlignment(HorizontalAlignment.CENTER); |
| | | writeCellStyle.setVerticalAlignment(VerticalAlignment.CENTER); |
| | | // 必须设置OriginCellStyle |
| | | cellData.setOriginCellStyle(originCellStyle); |
| | | |
| | | WriteFont headWriteFont = new WriteFont(); |
| | | headWriteFont.setFontHeightInPoints((short)12); |
| | | headWriteFont.setFontName("宋体"); |
| | | headWriteFont.setBold(false); |
| | | headWriteFont.setColor(IndexedColors.BLACK.getIndex()); |
| | | |
| | | cellData.getWriteCellStyle().setWriteFont(headWriteFont); |
| | | } |
| | | } |
| | | |
| New file |
| | |
| | | package com.dy.pipIrrGlobal.pojoPr; |
| | | |
| | | import com.alibaba.fastjson2.annotation.JSONField; |
| | | import com.alibaba.fastjson2.writer.ObjectWriterImplToString; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.dy.common.po.BaseEntity; |
| | | import jakarta.validation.constraints.NotNull; |
| | | import lombok.*; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-08-27 17:23 |
| | | * @LastEditTime 2024-08-27 17:23 |
| | | * @Description |
| | | */ |
| | | |
| | | /** |
| | | * 管网坐标表 |
| | | */ |
| | | |
| | | @TableName(value="pr_network_coordinates", autoResultMap = true) |
| | | @Data |
| | | @Builder |
| | | @ToString |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | public class PrNetworkCoordinates implements BaseEntity { |
| | | public static final long serialVersionUID = 202408271720001L; |
| | | |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @JSONField(serializeUsing= ObjectWriterImplToString.class) |
| | | @TableId(type = IdType.INPUT) |
| | | private Long id; |
| | | |
| | | /** |
| | | * 管网ID |
| | | */ |
| | | @JSONField(serializeUsing= ObjectWriterImplToString.class) |
| | | @NotNull(message = "所属管网不能为空") |
| | | private Long networkId; |
| | | |
| | | /** |
| | | * 纬度 |
| | | */ |
| | | private BigDecimal lat; |
| | | |
| | | /** |
| | | * 经度 |
| | | */ |
| | | private BigDecimal lng; |
| | | |
| | | } |
| New file |
| | |
| | | package com.dy.pipIrrGlobal.pojoPr; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-08-27 17:14 |
| | | * @LastEditTime 2024-08-27 17:14 |
| | | * @Description |
| | | */ |
| | | |
| | | import com.alibaba.fastjson2.annotation.JSONField; |
| | | import com.alibaba.fastjson2.writer.ObjectWriterImplToString; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.dy.common.po.BaseEntity; |
| | | import jakarta.validation.constraints.NotNull; |
| | | import lombok.*; |
| | | |
| | | /** |
| | | * 输配水管网表 |
| | | */ |
| | | |
| | | @TableName(value="pr_water_network", autoResultMap = true) |
| | | @Data |
| | | @Builder |
| | | @ToString |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | public class PrWaterNetwork implements BaseEntity { |
| | | public static final long serialVersionUID = 202408271719001L; |
| | | |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @JSONField(serializeUsing= ObjectWriterImplToString.class) |
| | | @TableId(type = IdType.INPUT) |
| | | private Long id; |
| | | |
| | | /** |
| | | * 管网类型;1-输水,2-配水 |
| | | */ |
| | | @NotNull(message = "管网类型不能为空") |
| | | private Byte networkType; |
| | | |
| | | } |
| New file |
| | |
| | | package com.dy.pipIrrGlobal.voPr; |
| | | |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.alibaba.fastjson2.annotation.JSONField; |
| | | import com.alibaba.fastjson2.writer.ObjectWriterImplToString; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-08-28 11:42 |
| | | * @LastEditTime 2024-08-28 11:42 |
| | | * @Description |
| | | */ |
| | | |
| | | @Data |
| | | public class VoNetwork { |
| | | private static final long serialVersionUID = 202408281143001L; |
| | | |
| | | /** |
| | | * 管网ID |
| | | */ |
| | | @JSONField(serializeUsing= ObjectWriterImplToString.class) |
| | | private Long networkId; |
| | | |
| | | /** |
| | | * 管网类型,1-输水,2-配水 |
| | | */ |
| | | private Byte type; |
| | | |
| | | /** |
| | | * 管网对象,包含管网坐标 |
| | | */ |
| | | private JSONObject data; |
| | | } |
| New file |
| | |
| | | package com.dy.pipIrrGlobal.voPr; |
| | | |
| | | import com.alibaba.fastjson2.annotation.JSONField; |
| | | import com.alibaba.fastjson2.writer.ObjectWriterImplToString; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-08-28 14:06 |
| | | * @LastEditTime 2024-08-28 14:06 |
| | | * @Description |
| | | */ |
| | | @Data |
| | | public class VoNetworkCoordinates { |
| | | private static final long serialVersionUID = 202408281407001L; |
| | | |
| | | /** |
| | | * 纬度 |
| | | */ |
| | | @JSONField(serializeUsing= ObjectWriterImplToString.class) |
| | | private BigDecimal lat; |
| | | |
| | | /** |
| | | * 经度 |
| | | */ |
| | | @JSONField(serializeUsing= ObjectWriterImplToString.class) |
| | | private BigDecimal lng; |
| | | } |
| | |
| | | package com.dy.pipIrrGlobal.voSe; |
| | | |
| | | import com.alibaba.excel.annotation.ExcelIgnore; |
| | | import com.alibaba.excel.annotation.ExcelProperty; |
| | | import com.alibaba.excel.annotation.write.style.ColumnWidth; |
| | | import com.alibaba.excel.annotation.write.style.ContentRowHeight; |
| | | import com.alibaba.excel.annotation.write.style.HeadRowHeight; |
| | | import com.alibaba.fastjson2.annotation.JSONField; |
| | | import com.alibaba.fastjson2.writer.ObjectWriterImplToString; |
| | | import com.dy.common.po.BaseEntity; |
| | |
| | | |
| | | @Data |
| | | @JsonPropertyOrder({ "generalId", "cashierId", "cashierName", "tradeAmount", "gift", "refundAmount", "totalAmount", "operateDate", "auditStatus"}) |
| | | @Schema(title = "财务对账之总账视图对象") |
| | | @HeadRowHeight(30) |
| | | @ContentRowHeight(20) |
| | | public class VoGeneral implements BaseEntity { |
| | | private static final long serialVersionUID = 202401241706001L; |
| | | |
| | | @Schema(title = "总账ID") |
| | | @JSONField(serializeUsing= ObjectWriterImplToString.class) |
| | | @ExcelIgnore |
| | | private Long generalId; |
| | | |
| | | @Schema(title = "收银员ID") |
| | | @JSONField(serializeUsing= ObjectWriterImplToString.class) |
| | | @ExcelIgnore |
| | | private Long cashierId; |
| | | |
| | | @Schema(title = "收银员姓名") |
| | | @ExcelProperty(value = {"${title}", "收银员姓名"}) |
| | | @ColumnWidth(18) |
| | | private String cashierName; |
| | | |
| | | @Schema(title = "实收金额") |
| | | @ExcelProperty(value = {"${title}", "实收金额"}) |
| | | @ColumnWidth(15) |
| | | private Float tradeAmount; |
| | | |
| | | @Schema(title = "赠送金额") |
| | | @ExcelProperty(value = {"${title}", "赠送金额"}) |
| | | @ColumnWidth(15) |
| | | private Float gift; |
| | | |
| | | @Schema(title = "返还金额") |
| | | @ExcelProperty(value = {"${title}", "返还金额"}) |
| | | @ColumnWidth(15) |
| | | private Float refundAmount; |
| | | |
| | | /** |
| | | * 总额 = 实收金额 + 赠送金额 + 返还金额 |
| | | * 总额 = 实收金额 + 赠送金额 - 返还金额 |
| | | */ |
| | | @Schema(title = "总额") |
| | | @ExcelProperty(value = {"${title}", "总额"}) |
| | | @ColumnWidth(10) |
| | | private Float totalAmount; |
| | | |
| | | @Schema(title = "交易日期") |
| | | @ExcelProperty(value = {"${title}", "交易日期"}) |
| | | @ColumnWidth(15) |
| | | private String operateDate; |
| | | |
| | | @Schema(title = "审核状态") |
| | | @ExcelProperty(value = {"${title}", "审核状态"}) |
| | | @ColumnWidth(15) |
| | | private String auditStatus; |
| | | |
| | | } |
| | |
| | | package com.dy.pipIrrGlobal.voSe; |
| | | |
| | | import com.alibaba.excel.annotation.ExcelIgnore; |
| | | import com.alibaba.excel.annotation.ExcelProperty; |
| | | import com.alibaba.excel.annotation.write.style.ColumnWidth; |
| | | import com.alibaba.excel.annotation.write.style.ContentRowHeight; |
| | | import com.alibaba.excel.annotation.write.style.HeadRowHeight; |
| | | import com.dy.common.po.BaseEntity; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.fasterxml.jackson.annotation.JsonPropertyOrder; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | |
| | | */ |
| | | |
| | | @Data |
| | | @Schema(title = "财务对账,交易明细视图对象") |
| | | @JsonPropertyOrder({ "cashierId", "villageId", "clientNum", "districtTitle", "clientName", "phone", "operateType", "tradeAmount", "waterCost", "cardCost", "gift", "refundAmount", "paymentName", "tradeTime"}) |
| | | @HeadRowHeight(30) |
| | | @ContentRowHeight(20) |
| | | public class VoTradeDetails implements BaseEntity { |
| | | private static final long serialVersionUID = 202402012040001L; |
| | | |
| | | @Schema(title = "收银员ID") |
| | | @ExcelIgnore |
| | | private String cashierId; |
| | | |
| | | @Schema(title = "区划名称串") |
| | | private String districtTitle; |
| | | |
| | | @Schema(title = "村庄ID") |
| | | @ExcelIgnore |
| | | private String villageId; |
| | | |
| | | @Schema(title = "农户姓名") |
| | | private String clientName; |
| | | |
| | | @Schema(title = "联系电话") |
| | | private String phone; |
| | | |
| | | @Schema(title = "农户编号") |
| | | @ExcelIgnore |
| | | private String clientNum; |
| | | |
| | | @Schema(title = "业务类型") |
| | | @ExcelProperty(value = {"${title}", "村庄名称"}) |
| | | @ColumnWidth(20) |
| | | private String districtTitle; |
| | | |
| | | @ExcelProperty(value = {"${title}", "农户姓名"}) |
| | | @ColumnWidth(15) |
| | | private String clientName; |
| | | |
| | | @ExcelProperty(value = {"${title}", "联系电话"}) |
| | | @ColumnWidth(15) |
| | | private String phone; |
| | | |
| | | @ExcelProperty(value = {"${title}", "业务类型"}) |
| | | @ColumnWidth(15) |
| | | private String operateType; |
| | | |
| | | @Schema(title = "交易金额") |
| | | @ExcelProperty(value = {"${title}", "交易金额"}) |
| | | @ColumnWidth(15) |
| | | private Double tradeAmount; |
| | | |
| | | @Schema(title = "购水金额") |
| | | @ExcelProperty(value = {"${title}", "购水金额"}) |
| | | @ColumnWidth(15) |
| | | private Double waterCost; |
| | | |
| | | @Schema(title = "购卡金额") |
| | | @ExcelProperty(value = {"${title}", "购卡金额"}) |
| | | @ColumnWidth(15) |
| | | private Double cardCost; |
| | | |
| | | @Schema(title = "赠送金额") |
| | | @ExcelProperty(value = {"${title}", "赠送金额"}) |
| | | @ColumnWidth(15) |
| | | private Double gift; |
| | | |
| | | @Schema(title = "返回金额") |
| | | @ExcelProperty(value = {"${title}", "返还金额"}) |
| | | @ColumnWidth(15) |
| | | private Double refundAmount; |
| | | |
| | | @Schema(title = "付款方式") |
| | | @ExcelProperty(value = {"${title}", "付款方式"}) |
| | | @ColumnWidth(15) |
| | | private String paymentName; |
| | | |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | @Schema(title = "交易时间") |
| | | @ExcelProperty(value = {"${title}", "交易时间"}) |
| | | @ColumnWidth(20) |
| | | private Date tradeTime; |
| | | |
| | | } |
| | |
| | | from ba_user |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | |
| | | <select id="getPhones" resultType="java.lang.String"> |
| | | SELECT phone FROM ba_user WHERE deleted = 0 and disabled = 0 |
| | | </select> |
| | | </mapper> |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.dy.pipIrrGlobal.daoPr.PrNetworkCoordinatesMapper"> |
| | | <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoPr.PrNetworkCoordinates"> |
| | | <!--@mbg.generated--> |
| | | <!--@Table pr_network_coordinates--> |
| | | <id column="id" jdbcType="BIGINT" property="id"/> |
| | | <result column="network_id" jdbcType="BIGINT" property="networkId"/> |
| | | <result column="lat" jdbcType="DECIMAL" property="lat"/> |
| | | <result column="lng" jdbcType="DECIMAL" property="lng"/> |
| | | </resultMap> |
| | | <sql id="Base_Column_List"> |
| | | <!--@mbg.generated--> |
| | | id, |
| | | network_id, |
| | | lat, |
| | | lng |
| | | </sql> |
| | | <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> |
| | | <!--@mbg.generated--> |
| | | select |
| | | <include refid="Base_Column_List"/> |
| | | from pr_network_coordinates |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> |
| | | <!--@mbg.generated--> |
| | | delete |
| | | from pr_network_coordinates |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </delete> |
| | | <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoPr.PrNetworkCoordinates"> |
| | | <!--@mbg.generated--> |
| | | insert into pr_network_coordinates (id, network_id, lat, |
| | | lng) |
| | | values (#{id,jdbcType=BIGINT}, #{networkId,jdbcType=BIGINT}, #{lat,jdbcType=DECIMAL}, |
| | | #{lng,jdbcType=DECIMAL}) |
| | | </insert> |
| | | <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoPr.PrNetworkCoordinates"> |
| | | <!--@mbg.generated--> |
| | | insert into pr_network_coordinates |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null"> |
| | | id, |
| | | </if> |
| | | <if test="networkId != null"> |
| | | network_id, |
| | | </if> |
| | | <if test="lat != null"> |
| | | lat, |
| | | </if> |
| | | <if test="lng != null"> |
| | | lng, |
| | | </if> |
| | | </trim> |
| | | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| | | <if test="id != null"> |
| | | #{id,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="networkId != null"> |
| | | #{networkId,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="lat != null"> |
| | | #{lat,jdbcType=DECIMAL}, |
| | | </if> |
| | | <if test="lng != null"> |
| | | #{lng,jdbcType=DECIMAL}, |
| | | </if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoPr.PrNetworkCoordinates"> |
| | | <!--@mbg.generated--> |
| | | update pr_network_coordinates |
| | | <set> |
| | | <if test="networkId != null"> |
| | | network_id = #{networkId,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="lat != null"> |
| | | lat = #{lat,jdbcType=DECIMAL}, |
| | | </if> |
| | | <if test="lng != null"> |
| | | lng = #{lng,jdbcType=DECIMAL}, |
| | | </if> |
| | | </set> |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoPr.PrNetworkCoordinates"> |
| | | <!--@mbg.generated--> |
| | | update pr_network_coordinates |
| | | set network_id = #{networkId,jdbcType=BIGINT}, |
| | | lat = #{lat,jdbcType=DECIMAL}, |
| | | lng = #{lng,jdbcType=DECIMAL} |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | |
| | | <!--清除全部管网坐标--> |
| | | <delete id="clearCoordinates"> |
| | | TRUNCATE pr_network_coordinates |
| | | </delete> |
| | | |
| | | <!--根据管网ID获取管网坐标列表--> |
| | | <select id="getCoordinatesByNetworkId" resultType="com.dy.pipIrrGlobal.voPr.VoNetworkCoordinates"> |
| | | SELECT lat, |
| | | lng |
| | | FROM pr_network_coordinates |
| | | WHERE network_id = #{networkId} |
| | | </select> |
| | | </mapper> |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.dy.pipIrrGlobal.daoPr.PrWaterNetworkMapper"> |
| | | <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoPr.PrWaterNetwork"> |
| | | <!--@mbg.generated--> |
| | | <!--@Table pr_water_network--> |
| | | <id column="id" jdbcType="BIGINT" property="id"/> |
| | | <result column="network_type" jdbcType="TINYINT" property="networkType"/> |
| | | </resultMap> |
| | | <sql id="Base_Column_List"> |
| | | <!--@mbg.generated--> |
| | | id, |
| | | network_type |
| | | </sql> |
| | | <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> |
| | | <!--@mbg.generated--> |
| | | select |
| | | <include refid="Base_Column_List"/> |
| | | from pr_water_network |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> |
| | | <!--@mbg.generated--> |
| | | delete |
| | | from pr_water_network |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </delete> |
| | | <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoPr.PrWaterNetwork"> |
| | | <!--@mbg.generated--> |
| | | insert into pr_water_network (id, network_type) |
| | | values (#{id,jdbcType=BIGINT}, #{networkType,jdbcType=TINYINT}) |
| | | </insert> |
| | | <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoPr.PrWaterNetwork"> |
| | | <!--@mbg.generated--> |
| | | insert into pr_water_network |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null"> |
| | | id, |
| | | </if> |
| | | <if test="networkType != null"> |
| | | network_type, |
| | | </if> |
| | | </trim> |
| | | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| | | <if test="id != null"> |
| | | #{id,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="networkType != null"> |
| | | #{networkType,jdbcType=TINYINT}, |
| | | </if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoPr.PrWaterNetwork"> |
| | | <!--@mbg.generated--> |
| | | update pr_water_network |
| | | <set> |
| | | <if test="networkType != null"> |
| | | network_type = #{networkType,jdbcType=TINYINT}, |
| | | </if> |
| | | </set> |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoPr.PrWaterNetwork"> |
| | | <!--@mbg.generated--> |
| | | update pr_water_network |
| | | set network_type = #{networkType,jdbcType=TINYINT} |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | |
| | | <!--清除全部管网--> |
| | | <delete id="clearNetworks"> |
| | | TRUNCATE pr_water_network |
| | | </delete> |
| | | |
| | | <!--获取全部管网--> |
| | | <select id="getAllNewworks" resultType="com.dy.pipIrrGlobal.voPr.VoNetwork"> |
| | | SELECT id AS networkId, |
| | | network_type AS type |
| | | FROM pr_water_network |
| | | </select> |
| | | </mapper> |
| | |
| | | datasource: #配置数据源 |
| | | type: com.alibaba.druid.pool.DruidDataSource |
| | | driver-class-name: com.mysql.cj.jdbc.Driver |
| | | #url: jdbc:mysql://192.168.40.166:3306/pipIrr_ym?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&useSSL=false&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull |
| | | # url: jdbc:mysql://192.168.40.166:3306/pipIrr_ym?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&useSSL=false&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull |
| | | #url: jdbc:mysql://8.130.130.233:3306/pipIrr_ym?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&useSSL=false&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull |
| | | #url: jdbc:mysql://8.140.179.55:3306/pipIrr_ym?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&useSSL=false&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull |
| | | url: jdbc:mysql://127.0.0.1:3306/pipIrr_ym?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&useSSL=false&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull |
| | |
| | | prController.setRtuAddr(prControllerTramp.getRtuAddr()); |
| | | prController.setProtocol(prControllerTramp.getProtocol()); |
| | | prController.setFindDt(prControllerTramp.getFindDt()); |
| | | prController.setOrgTag(prControllerTramp.getOrgTag()); |
| | | prController.setAddWays((byte) 1); |
| | | prController.setOperator(operator); |
| | | Date operateTime = new Date(); |
| | |
| | | prControllerTramp.setRtuAddr(ControllerList.getRtuAddr()); |
| | | prControllerTramp.setProtocol(ControllerList.getProtocol()); |
| | | prControllerTramp.setFindDt(new Date()); |
| | | prControllerTramp.setOrgTag(ControllerList.getOrgTag()); |
| | | Integer rec_addControllerTramp = Optional.ofNullable(intakeControllerSv.addTrampController(prControllerTramp)).orElse(0); |
| | | if (rec_addControllerTramp == 0) { |
| | | return BaseResponseUtils.buildFail(ProjectResultCode.ADD_TRAMP_CONTROLLER_FAIL.getMessage()); |
| New file |
| | |
| | | package com.dy.pipIrrProject.network; |
| | | |
| | | import com.dy.common.aop.SsoAop; |
| | | import com.dy.common.webUtil.BaseResponse; |
| | | import com.dy.common.webUtil.BaseResponseUtils; |
| | | import com.dy.pipIrrGlobal.voPr.VoNetwork; |
| | | import com.dy.pipIrrProject.network.dto.Network; |
| | | import jakarta.validation.Valid; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.http.MediaType; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.validation.BindingResult; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-08-27 17:08 |
| | | * @LastEditTime 2024-08-27 17:08 |
| | | * @Description |
| | | */ |
| | | |
| | | @Slf4j |
| | | @RestController |
| | | @RequestMapping(path = "network") |
| | | @RequiredArgsConstructor |
| | | public class NetworkCtrl { |
| | | private final NetworkSv networkSv; |
| | | |
| | | /** |
| | | * 添加管网 |
| | | * @param po |
| | | * @param bindingResult |
| | | * @return |
| | | */ |
| | | @PostMapping(path = "save", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> save(@RequestBody @Valid Network po, BindingResult bindingResult) { |
| | | if (bindingResult != null && bindingResult.hasErrors()) { |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | | |
| | | String result = networkSv.addNetworks(po); |
| | | if(result.trim().length()> 0) { |
| | | return BaseResponseUtils.buildErrorMsg(result); |
| | | } |
| | | |
| | | //PrWaterNetwork prWaterNetwork = null; |
| | | //Long networkId = null; |
| | | // |
| | | //JSONArray networks = po.getData(); |
| | | //for (int i = 0; i < networks.size(); i++) { |
| | | // // 取出一笔绘画 |
| | | // JSONObject polyline = networks.getJSONObject(i); |
| | | // // 添加该笔绘画 |
| | | // prWaterNetwork = new PrWaterNetwork(); |
| | | // prWaterNetwork.setNetworkType(po.getType()); |
| | | // networkId = networkSv.addNetwork(prWaterNetwork); |
| | | // |
| | | // // 取出一笔绘画中的坐标点 |
| | | // JSONArray coordinates = polyline.getJSONArray("coordinates"); |
| | | // for (int j = 0; j < coordinates.size(); j++) { |
| | | // JSONObject point = coordinates.getJSONObject(j); |
| | | // |
| | | // PrNetworkCoordinates prNetworkCoordinates = new PrNetworkCoordinates(); |
| | | // prNetworkCoordinates.setNetworkId(networkId); |
| | | // prNetworkCoordinates.setLat(point.getBigDecimal("lat")); |
| | | // prNetworkCoordinates.setLng(point.getBigDecimal("lng")); |
| | | // |
| | | // Long coordinateId = Optional.ofNullable(networkSv.addNetworkCoordinate(prNetworkCoordinates)).orElse(0L); |
| | | // if (coordinateId.equals(0)) { |
| | | // return BaseResponseUtils.buildErrorMsg(ProjectResultCode.SAVA_NETWORK_ERROR.getMessage()); |
| | | // } |
| | | // } |
| | | //} |
| | | return BaseResponseUtils.buildSuccess(true); |
| | | } |
| | | |
| | | /** |
| | | * 获取全部管网 |
| | | * @return |
| | | */ |
| | | @GetMapping(path = "/all") |
| | | @SsoAop() |
| | | public BaseResponse<List<VoNetwork>> getNetworks() { |
| | | try { |
| | | return BaseResponseUtils.buildSuccess(networkSv.getNetworks()); |
| | | } catch (Exception e) { |
| | | log.error("获取开卡记录异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()); |
| | | } |
| | | } |
| | | } |
| New file |
| | |
| | | package com.dy.pipIrrProject.network; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.alibaba.fastjson2.JSONArray; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.dy.pipIrrGlobal.daoPr.PrNetworkCoordinatesMapper; |
| | | import com.dy.pipIrrGlobal.daoPr.PrWaterNetworkMapper; |
| | | import com.dy.pipIrrGlobal.pojoPr.PrNetworkCoordinates; |
| | | import com.dy.pipIrrGlobal.pojoPr.PrWaterNetwork; |
| | | import com.dy.pipIrrGlobal.voPr.VoNetwork; |
| | | import com.dy.pipIrrGlobal.voPr.VoNetworkCoordinates; |
| | | import com.dy.pipIrrProject.network.dto.Network; |
| | | import com.dy.pipIrrProject.result.ProjectResultCode; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Optional; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-08-27 17:08 |
| | | * @LastEditTime 2024-08-27 17:08 |
| | | * @Description |
| | | */ |
| | | |
| | | @Slf4j |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class NetworkSv { |
| | | private final PrWaterNetworkMapper prWaterNetworkMapper; |
| | | private final PrNetworkCoordinatesMapper prNetworkCoordinatesMapper; |
| | | |
| | | /** |
| | | * 添加管网 |
| | | * @param po |
| | | * @return |
| | | */ |
| | | public Long addNetwork(PrWaterNetwork po) { |
| | | prWaterNetworkMapper.insert(po); |
| | | return po.getId(); |
| | | } |
| | | |
| | | /** |
| | | * 添加管网坐标 |
| | | * @param po |
| | | * @return |
| | | */ |
| | | public Long addNetworkCoordinate(PrNetworkCoordinates po) { |
| | | prNetworkCoordinatesMapper.insert(po); |
| | | return po.getId(); |
| | | }; |
| | | |
| | | /** |
| | | * 添加管网 |
| | | * @param po |
| | | * @return |
| | | */ |
| | | public String addNetworks(Network po) { |
| | | String result = ""; |
| | | PrWaterNetwork prWaterNetwork = null; |
| | | Long networkId = null; |
| | | |
| | | prWaterNetworkMapper.clearNetworks(); |
| | | prNetworkCoordinatesMapper.clearCoordinates(); |
| | | |
| | | JSONArray networks = po.getData(); |
| | | for (int i = 0; i < networks.size(); i++) { |
| | | // 取出一笔绘画 |
| | | JSONObject polyline = networks.getJSONObject(i); |
| | | // 添加该笔绘画 |
| | | prWaterNetwork = new PrWaterNetwork(); |
| | | prWaterNetwork.setNetworkType(po.getType()); |
| | | networkId = addNetwork(prWaterNetwork); |
| | | |
| | | // 取出一笔绘画中的坐标点 |
| | | JSONArray coordinates = polyline.getJSONArray("coordinates"); |
| | | for (int j = 0; j < coordinates.size(); j++) { |
| | | JSONObject point = coordinates.getJSONObject(j); |
| | | |
| | | PrNetworkCoordinates prNetworkCoordinates = new PrNetworkCoordinates(); |
| | | prNetworkCoordinates.setNetworkId(networkId); |
| | | prNetworkCoordinates.setLat(point.getBigDecimal("lat")); |
| | | prNetworkCoordinates.setLng(point.getBigDecimal("lng")); |
| | | |
| | | Long coordinateId = Optional.ofNullable(addNetworkCoordinate(prNetworkCoordinates)).orElse(0L); |
| | | if (coordinateId.equals(0)) { |
| | | //return BaseResponseUtils.buildErrorMsg(ProjectResultCode.SAVA_NETWORK_ERROR.getMessage()); |
| | | result = ProjectResultCode.SAVA_NETWORK_ERROR.getMessage(); |
| | | } |
| | | } |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * 获取全部管网 |
| | | * @return |
| | | */ |
| | | public List<VoNetwork> getNetworks() { |
| | | JSONArray array_result = new JSONArray(); |
| | | JSONArray array_networks = null; |
| | | |
| | | List<VoNetwork> list_networks = prWaterNetworkMapper.getAllNewworks(); |
| | | if(list_networks != null && list_networks.size() > 0) { |
| | | array_networks = (JSONArray) JSON.toJSON(list_networks); |
| | | for (int i = 0; i < array_networks.size(); i++) { |
| | | JSONObject job_network = array_networks.getJSONObject(i); |
| | | |
| | | List<VoNetworkCoordinates> list_networkCoordinates = prNetworkCoordinatesMapper.getCoordinatesByNetworkId(job_network.getLong("networkId")); |
| | | if(list_networkCoordinates == null) { |
| | | list_networkCoordinates = new ArrayList<>(); |
| | | } |
| | | |
| | | JSONObject job_points = new JSONObject(); |
| | | job_points.put("type", "Polyline"); |
| | | job_points.put("coordinates", (JSONArray) JSON.toJSON(list_networkCoordinates)); |
| | | job_network.put("data", job_points); |
| | | array_result.add(job_network); |
| | | } |
| | | return array_result.toList(VoNetwork.class); |
| | | |
| | | }else { |
| | | return new ArrayList<>(); |
| | | } |
| | | } |
| | | } |
| New file |
| | |
| | | package com.dy.pipIrrProject.network.dto; |
| | | |
| | | import com.alibaba.fastjson2.JSONArray; |
| | | import jakarta.validation.constraints.NotNull; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-08-28 10:23 |
| | | * @LastEditTime 2024-08-28 10:23 |
| | | * @Description 管网传输对象 |
| | | */ |
| | | |
| | | @Data |
| | | public class Network { |
| | | public static final long serialVersionUID = 202408281024001L; |
| | | |
| | | /** |
| | | * 管网类型,1-输水,2-配水 |
| | | */ |
| | | @NotNull(message = "管网类型不能为空") |
| | | private Byte type; |
| | | |
| | | /** |
| | | * 管网对象数组,每个对象是一笔绘画 |
| | | */ |
| | | private JSONArray data; |
| | | } |
| | |
| | | MONITORING_FLOWMETER_BIND_FAIL(70002, "流量监测站与流量计绑定失败"), |
| | | STATION_OR_FLOWMETER_NO_EXIST(70003, "流量监测站或流量计不存在"), |
| | | STATION_FLOWMETER_HAS_UNBOUND(70004, "流量监测站与流量计已解绑"), |
| | | NO_MONITORING_FLOWMETERS(70005, "没有符合条件的绑定记录数据"); |
| | | NO_MONITORING_FLOWMETERS(70005, "没有符合条件的绑定记录数据"), |
| | | |
| | | /** |
| | | * 管网 |
| | | */ |
| | | SAVA_NETWORK_ERROR(30001, "保存管网失败"); |
| | | |
| | | private final Integer code; |
| | | private final String message; |
| | |
| | | package com.dy.pipIrrSell.general; |
| | | |
| | | import com.alibaba.excel.EasyExcel; |
| | | import com.dy.common.aop.SsoAop; |
| | | import com.dy.common.webUtil.BaseResponse; |
| | | import com.dy.common.webUtil.BaseResponseUtils; |
| | | import com.dy.common.webUtil.QueryResultVo; |
| | | import com.dy.common.webUtil.ResultCodeMsg; |
| | | import com.dy.pipIrrGlobal.excel.ExcelUtil; |
| | | import com.dy.pipIrrGlobal.excel.ReportExportCellWriteHandler; |
| | | import com.dy.pipIrrGlobal.pojoBa.BaClient; |
| | | import com.dy.pipIrrGlobal.pojoSe.SeAudits; |
| | | import com.dy.pipIrrGlobal.pojoSe.SeGeneral; |
| | | import com.dy.pipIrrGlobal.voSe.VoGeneral; |
| | | import com.dy.pipIrrGlobal.voSe.VoTradeDetails; |
| | | import com.dy.pipIrrSell.general.dto.DtoGeneral; |
| | | import com.dy.pipIrrSell.general.qo.QoGeneral; |
| | | import com.dy.pipIrrSell.general.qo.QoSummary; |
| | |
| | | import io.swagger.v3.oas.annotations.responses.ApiResponse; |
| | | import io.swagger.v3.oas.annotations.responses.ApiResponses; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import jakarta.validation.Valid; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.SneakyThrows; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.http.MediaType; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.validation.BindingResult; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.io.IOException; |
| | | import java.time.LocalDate; |
| | | import java.util.*; |
| | | |
| | | /** |
| | |
| | | try { |
| | | add_general(); |
| | | QueryResultVo<List<VoGeneral>> res = generalSv.getGenerals(vo); |
| | | if(res.itemTotal > 0) { |
| | | return BaseResponseUtils.buildSuccess(res); |
| | | }else { |
| | | return BaseResponseUtils.buildSuccess(SellResultCode.No_GENERALS.getMessage()); |
| | | } |
| | | return BaseResponseUtils.buildSuccess(res); |
| | | } catch (Exception e) { |
| | | log.error("查询交易记录异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()) ; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 导出总账记录 |
| | | * @param response |
| | | * @param vo |
| | | */ |
| | | @SneakyThrows(IOException.class) |
| | | @RequestMapping(value = "/export_general", method = RequestMethod.GET) |
| | | @SsoAop() |
| | | public void exportGeneral(HttpServletResponse response, QoGeneral vo) { |
| | | ExcelUtil.setExcelRespProp(response, "总账" + LocalDate.now()); |
| | | List<VoGeneral> generalList = generalSv.exportGenerals(vo).getObj(); |
| | | |
| | | EasyExcel.write(response.getOutputStream(), VoGeneral.class) |
| | | .registerWriteHandler(new ReportExportCellWriteHandler("财务对账-总账")) |
| | | .sheet("总账") |
| | | .doWrite(generalList); |
| | | } |
| | | |
| | | /** |
| | |
| | | @SsoAop() |
| | | public BaseResponse<Map> getTradeDetails(QoToAudit vo){ |
| | | try { |
| | | Map res = Optional.ofNullable(generalSv.getTradeDetails(vo)).orElse(new HashMap()); |
| | | if(res.size() > 0) { |
| | | return BaseResponseUtils.buildSuccess(res); |
| | | }else { |
| | | return BaseResponseUtils.buildFail(SellResultCode.No_TRADE_DETAILS.getMessage()); |
| | | } |
| | | return BaseResponseUtils.buildSuccess(generalSv.getTradeDetails(vo)); |
| | | } catch (Exception e) { |
| | | log.error("查询交易记录异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()) ; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 导出财务对账_交易明细 |
| | | * @param response |
| | | * @param vo |
| | | */ |
| | | @SneakyThrows(IOException.class) |
| | | @RequestMapping(value = "/export_trade_details", method = RequestMethod.GET) |
| | | @SsoAop() |
| | | public void exportTradeDetails(HttpServletResponse response, QoToAudit vo) { |
| | | ExcelUtil.setExcelRespProp(response, "交易明细" + LocalDate.now()); |
| | | |
| | | Map map_result = generalSv.exportTradeDetails(vo); |
| | | Map map_record = (Map) map_result.get("records"); |
| | | List<VoTradeDetails> list = (List<VoTradeDetails>) map_record.get("list"); |
| | | Double totalTradeAmount = Double.parseDouble(map_result.get("totalTradeAmount").toString()); |
| | | VoTradeDetails po = new VoTradeDetails(); |
| | | po.setTradeAmount(totalTradeAmount); |
| | | list.add(po); |
| | | |
| | | EasyExcel.write(response.getOutputStream(), VoTradeDetails.class) |
| | | .registerWriteHandler(new ReportExportCellWriteHandler("财务对账-交易明细")) |
| | | .sheet("交易明细") |
| | | .doWrite(list); |
| | | } |
| | | } |
| | |
| | | rsVo.pageSize = queryVo.pageSize ; |
| | | rsVo.pageCurr = queryVo.pageCurr ; |
| | | |
| | | rsVo.calculateAndSet(itemTotal, params); |
| | | rsVo.obj = seGeneralMapper.getGenerals(params); |
| | | return rsVo ; |
| | | } |
| | | |
| | | /** |
| | | * 导出指定条件的总账记录 |
| | | * @param queryVo |
| | | * @return |
| | | */ |
| | | public QueryResultVo<List<VoGeneral>> exportGenerals(QoGeneral queryVo) { |
| | | Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(queryVo); |
| | | |
| | | Long itemTotal = seGeneralMapper.getRecordCount(params); |
| | | QueryResultVo<List<VoGeneral>> rsVo = new QueryResultVo<>() ; |
| | | |
| | | rsVo.calculateAndSet(itemTotal, params); |
| | | params.remove("start"); |
| | | params.remove("count"); |
| | | rsVo.obj = seGeneralMapper.getGenerals(params); |
| | | return rsVo ; |
| | | } |
| | |
| | | return map_result; |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 导出交易明细记录 |
| | | * @param queryVo |
| | | * @return |
| | | */ |
| | | public Map exportTradeDetails(QoToAudit queryVo) { |
| | | DecimalFormat df = new DecimalFormat("0.00"); |
| | | Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(queryVo); |
| | | |
| | | Long itemTotal = seGeneralMapper.getTradeDetailsRecordCount(params); |
| | | |
| | | QueryResultVo<List<VoTradeDetails>> rsVo = new QueryResultVo<>() ; |
| | | rsVo.pageSize = queryVo.pageSize ; |
| | | rsVo.pageCurr = queryVo.pageCurr ; |
| | | |
| | | rsVo.calculateAndSet(itemTotal, params); |
| | | params.remove("start"); |
| | | params.remove("count"); |
| | | List<VoTradeDetails> list = Optional.ofNullable(seGeneralMapper.getTradeDetails(params)).orElse(new ArrayList<>()); |
| | | if(list.size() == 0) { |
| | | return new HashMap(); |
| | | } |
| | | |
| | | // 遍历交易明细记录,汇总交易金额 |
| | | Double totalTradeAmount = 0.0; |
| | | JSONArray array= JSONArray.parseArray(JSON.toJSONString(list)); |
| | | for(int i = 0; i < array.size(); i++) { |
| | | JSONObject job = array.getJSONObject(i); |
| | | Double tradeAmount = Optional.ofNullable(job.getDouble("tradeAmount")).orElse(0.0); |
| | | totalTradeAmount = totalTradeAmount + tradeAmount; |
| | | } |
| | | |
| | | Map map_record = new HashMap(); |
| | | map_record.put("itemTotal", rsVo.itemTotal); |
| | | map_record.put("pageCurr", rsVo.pageCurr); |
| | | map_record.put("pageSize", rsVo.pageSize); |
| | | map_record.put("pageTotal", rsVo.pageTotal); |
| | | map_record.put("list", list); |
| | | |
| | | Map map_result = new HashMap(); |
| | | |
| | | map_result.put("totalTradeAmount", df.format(totalTradeAmount)); |
| | | map_result.put("records", map_record); |
| | | |
| | | return map_result; |
| | | |
| | | } |
| | | } |
| | |
| | | * 总账 |
| | | */ |
| | | GENERAL_ID_CANNOT_BE_NULL(80001, "总账编号不能为空"), |
| | | GENERAL_NOT_EXIST(80001, "总账不存在"), |
| | | GENERAL_AUDIT_FAIL(80001, "总账审核失败"), |
| | | AUDITS_ADD_FAIL(80001, "总账审核记录添加失败"), |
| | | GENERAL_NOT_EXIST(80002, "总账不存在"), |
| | | GENERAL_AUDIT_FAIL(80003, "总账审核失败"), |
| | | AUDITS_ADD_FAIL(80004, "总账审核记录添加失败"), |
| | | GENERAL_IS_NULL(80005, "要导出的总账为空"), |
| | | TRADE_DETAILS_IS_NULL(80006, "要导出的交易明细为空"), |
| | | |
| | | /** |
| | | * 虚拟卡 |
| | |
| | | if(bindingResult != null && bindingResult.hasErrors()){ |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | | if(vo.phone == null || vo.phone.trim().length() == 0){ |
| | | return BaseResponseUtils.buildFail("手机号不能为空"); |
| | | } |
| | | if(!vo.phone.equals("admin")){ |
| | | if(vo.phone.length() != 11){ |
| | | return BaseResponseUtils.buildFail("手机号(长度不是11位)不正确"); |
| | |
| | | } |
| | | //把组织单位标签作为数据源名称 |
| | | DataSourceContext.set(vo.orgTag); |
| | | |
| | | //得到所有用户账号 |
| | | List<String> phones = sv.getPhones(); |
| | | if(!phones.contains(vo.phone)){ |
| | | return BaseResponseUtils.buildFail("账号不存在"); |
| | | } |
| | | |
| | | String uuid ; |
| | | BaUser userPo ; |
| | |
| | | uVo.token = uuid ; |
| | | return BaseResponseUtils.buildSuccess(uVo); |
| | | }else{ |
| | | return BaseResponseUtils.buildFail("登录失败"); |
| | | return BaseResponseUtils.buildFail("密码错误"); |
| | | } |
| | | } |
| | | |
| | |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Slf4j |
| | | @Service |
| | | public class SsoSv { |
| | |
| | | return null ; |
| | | } |
| | | |
| | | /** |
| | | * 得到所有用户手机号 |
| | | * @return |
| | | */ |
| | | public List<String> getPhones(){ |
| | | return baUserMapper.getPhones() ; |
| | | } |
| | | } |