Commit 43405264 authored by tanyang's avatar tanyang

措施费相关导入解析及接口

parent 64babde0
package com.dsk.cscec.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.dev33.satoken.annotation.SaIgnore;
import cn.hutool.core.lang.Assert;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.excel.EasyExcel;
import com.dsk.common.annotation.Log;
import com.dsk.common.constant.GlobalConstants;
import com.dsk.common.core.domain.PageQuery;
import com.dsk.common.core.domain.R;
import com.dsk.common.core.domain.entity.SysDictData;
import com.dsk.common.core.page.TableDataInfo;
import com.dsk.common.enums.BusinessType;
import com.dsk.common.excel.ExcelResult;
import com.dsk.common.helper.LoginHelper;
import com.dsk.common.utils.poi.ExcelUtil;
import com.dsk.common.utils.redis.RedisUtils;
import com.dsk.cscec.domain.CbCostMeasure;
import com.dsk.cscec.domain.bo.CbCostMeasureActualBo;
import com.dsk.cscec.domain.bo.CbCostMeasureActualPushBo;
import com.dsk.cscec.domain.bo.CbCostMeasureActualSaveBo;
import com.dsk.cscec.domain.vo.CbCostMeasureActualVo;
import com.dsk.cscec.domain.vo.CbCostMeasuresImportVo;
import com.dsk.cscec.domain.vo.CbCostMeasuresItemVo;
import com.dsk.cscec.listener.ProjectCostMeasureImportListener;
import com.dsk.cscec.service.ICbCostMeasureService;
import com.dsk.system.domain.vo.SysUserImportVo;
import com.dsk.system.listener.SysUserImportListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* 措施费导入
*
* @author tanyang
* @create 2024-02-04 11:44
**/
@RequestMapping("/cb/cost/measures")
@RestController
public class CbCostMeasureController {
@Autowired
private ICbCostMeasureService cbCostMeasureService;
/**
* 措施费一级大类
* 根据项目查询措施费一级大类
*
* @param projectId 项目ID
* @return {@link R}<{@link List}<{@link Map}<{@link String}, {@link Object}>>>
*/
@SaIgnore
@GetMapping(value = "/type/{projectId}")
public R<List<Map<String, Object>>> dictType(@PathVariable Long projectId) {
List<Map<String, Object>> data = cbCostMeasureService.listByLevel(projectId,0);
if (ObjectUtil.isNull(data)) {
data = new ArrayList<>();
}
return R.ok(data);
}
/**
* 措施费列表
* 查询措施费列表
*
* @param cbCostMeasure CB成本衡量标准
* @return {@link R}<{@link List}<{@link CbCostMeasureActualVo}>>
*/
// @SaCheckPermission("cb:costmeasures:list")
@SaIgnore
@GetMapping("/list")
public R<List<CbCostMeasureActualVo>> list(CbCostMeasureActualBo cbCostMeasure) {
List<CbCostMeasureActualVo> data= cbCostMeasureService.selectDataList(cbCostMeasure);
if (ObjectUtil.isNull(data)) {
data = new ArrayList<>();
}
return R.ok(data);
}
/**
* 批量保存或修改每月措施费
*/
// @SaCheckPermission("cb:costmeasures:actual:saveBatch")
@SaIgnore
@PostMapping("/saveBatch")
public R saveBatch(@RequestBody List<CbCostMeasureActualSaveBo> boList) {
Assert.notEmpty(boList,"措施费填写信息不能为空!");
cbCostMeasureService.saveBatchCostMeasureActual(boList);
return R.ok();
}
/**
* 推送工程量
* 措施费-推送每月工程量
*
* @param pushBo 推送BO
* @return {@link R}<{@link List}<{@link CbCostMeasureActualVo}>>
*/
// @SaCheckPermission("cb:costmeasures:actual:push")
@SaIgnore
@PostMapping("/push/project/volume")
public R pushProjectVolume(@RequestBody CbCostMeasureActualPushBo pushBo) {
Assert.notNull(pushBo,"推送工程量信息不能为空!");
cbCostMeasureService.pushCostMeasureActual(pushBo);
return R.ok();
}
/**
* 获取批量措施费列表
*/
@Log(title = "措施费导出", businessType = BusinessType.EXPORT)
// @SaCheckPermission("system:user:export")
@PostMapping("/export")
public void exportProjectMeasures(HttpServletResponse response) {
String BATCH_IMPORT_FAIL_USERS = GlobalConstants.GLOBAL_REDIS_KEY + "batch_import_fail_users";
String key = BATCH_IMPORT_FAIL_USERS + LoginHelper.getUserId();
ExcelUtil.exportExcel(RedisUtils.getCacheList(key), "措施费", CbCostMeasuresImportVo.class, response);
RedisUtils.deleteObject(key);
}
/**
* 导入数据
*
* @param file 导入文件
* @param projectId 项目id
*/
// @SaIgnore
@Log(title = "措施费导入", businessType = BusinessType.IMPORT)
// @SaCheckPermission("system:user:import")
@PostMapping(value = "/importData", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
public R<Void> importData(@RequestPart("file") MultipartFile file, Long projectId) throws Exception {
cbCostMeasureService.importExcelData(file,projectId);
return R.ok();
}
/**
* 导入数据
*
* @param file 导入文件
* @param projectId 项目id
*/
@SaIgnore
@Log(title = "措施费汇总导入", businessType = BusinessType.IMPORT)
// @SaCheckPermission("system:user:import")
@PostMapping(value = "/summary/importData", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
public R<Void> importSummaryData(@RequestPart("file") MultipartFile file, Long projectId) throws Exception {
Integer dataType=2;
cbCostMeasureService.importExcelSummaryData(file,projectId,dataType);
return R.ok();
}
public static void main(String[] args) throws FileNotFoundException {
List list =new ArrayList<>();
File file=new File("E:\\dingding\\202401\\导入表格\\措施费\\大型机械费.xlsx");
FileInputStream inputStream=new FileInputStream(file);
ExcelResult<CbCostMeasuresImportVo> result = ExcelUtil.importExcel(inputStream, CbCostMeasuresImportVo.class, new ProjectCostMeasureImportListener(1L,1));
String analysis = result.getAnalysis();
List<CbCostMeasuresImportVo> list1 = result.getList();
System.out.println(">>>>>>>>>>"+analysis);
// System.out.println(JSONUtil.toJsonStr(list));
}
}
package com.dsk.cscec.domain;
import java.math.BigDecimal;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
/**
* 项目每月实际措施费
*/
@Data
@TableName(value="cb_cost_measure")
public class CbCostMeasure {
/**
* 主键
*/
@TableId(type = IdType.AUTO)
private Long id;
/**
* 项目ID
*/
private Long projectId;
/**
* 成本阶段( 0:标前成本、1:标后成本、2:转固成本)
*/
private Integer cbStage;
/**
* 父项id
*/
private Long parentId;
/**
* 层级数
*/
private Integer level;
private String number;
private String no;
/**
* 清单内容
*/
private String itemContent;
/**
* 工作内容、做法/规格型号/施工现场配置说明
*/
private String workContent;
/**
* 单位
*/
private String unit;
/**
* 工程量
*/
private BigDecimal quantity;
/**
* 不含税单价
*/
private String unitPriceExcludingTax;
/**
* 使用时间
*/
private String usageTime;
/**
* 不含税合价
*/
private String amountExcludingTax;
/**
* 税率(%)
*/
private String taxRate;
/**
* 含税合价
*/
private String amountIncludingTax;
/**
* 摊销比例(%)
*/
private String amortizationRatio;
/**
* 摊销后不含税合价
*/
private String amountExcludeTaxAmortized;
/**
* 摊销后含税合价
*/
private String amountIncludeTaxAmortized;
/**
* 税金(元)
*/
private String taxAmount;
/**
* 备注
*/
private String remarks;
/**
* 成本科目
*/
private String costSubject;
/**
* 税金类型
*/
private String taxType;
/**
* 数据来源(0:导入,1:手动添加)
*/
private Integer dataSource;
/**
* 创建时间
*/
private Date createTime;
/**
* 更新时间
*/
private Date updateTime;
}
\ No newline at end of file
package com.dsk.cscec.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.math.BigDecimal;
import java.util.Date;
import lombok.Data;
@Data
@TableName(value = "cb_cost_measure_actual")
public class CbCostMeasureActual {
/**
* 主键
*/
@TableId(value = "id", type = IdType.INPUT)
private Long id;
/**
* 计划成本措施费id
*/
@TableField(value = "plan_measure_id")
private Long planMeasureId;
/**
* 本月发生成本比例
*/
@TableField(value = "month_cost_rate")
private BigDecimal monthCostRate;
/**
* 成本合价
*/
@TableField(value = "cost_effective")
private BigDecimal costEffective;
/**
* 截止本月工程量
*/
@TableField(value = "current_project_volume")
private BigDecimal currentProjectVolume;
/**
* 推送工程量
*/
@TableField(value = "submit_project_volume")
private BigDecimal submitProjectVolume;
/**
* 年月
*/
@TableField(value = "`month`")
private String month;
/**
* 推送时间
*/
@TableField(value = "push_time")
private Date pushTime;
/**
* 推送数据json
*/
@TableField(value = "push_data_json")
private String pushDataJson;
/**
* 是否删除
*/
@TableField(value = "del_flag")
private Integer delFlag;
/**
* 修改人
*/
@TableField(value = "update_user")
private String updateUser;
/**
* 修改人id
*/
@TableField(value = "update_id")
private Long updateId;
/**
* 创建时间
*/
@TableField(value = "create_time")
private Date createTime;
/**
* 更新时间
*/
@TableField(value = "update_time")
private Date updateTime;
public static final String COL_ID = "id";
public static final String COL_PLAN_MEASURE_ID = "plan_measure_id";
public static final String COL_MONTH_COST_RATE = "month_cost_rate";
public static final String COL_COST_EFFECTIVE = "cost_effective";
public static final String COL_CURRENT_PROJECT_VOLUME = "current_project_volume";
public static final String COL_SUBMIT_PROJECT_VOLUME = "submit_project_volume";
public static final String COL_MONTH = "month";
public static final String COL_PUSH_TIME = "push_time";
public static final String COL_PUSH_DATA_JSON = "push_data_json";
public static final String COL_DEL_FLAG = "del_flag";
public static final String COL_UPDATE_USER = "update_user";
public static final String COL_UPDATE_ID = "update_id";
public static final String COL_CREATE_TIME = "create_time";
public static final String COL_UPDATE_TIME = "update_time";
}
\ No newline at end of file
......@@ -16,7 +16,7 @@ public class CbProjectExpenseSummary {
/**
* 主键ID
*/
@TableId(value = "id", type = IdType.INPUT)
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**
......
package com.dsk.cscec.domain.bo;
import com.baomidou.mybatisplus.annotation.TableField;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
@Data
public class CbCostMeasureActualBo {
/**
* 措施费用项id
*/
private Long id;
/**
* 年月
*/
private String month;
/**
* 项目id
*/
private Long projectId;
/**
* 成本阶段( 0:标前成本、1:标后成本、2:转固成本)
*/
private Integer cbStage;
}
\ No newline at end of file
package com.dsk.cscec.domain.bo;
import com.baomidou.mybatisplus.annotation.TableField;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
@Data
public class CbCostMeasureActualPushBo {
/**
* 主键
*/
private Long id;
/**
* 截止本月工程量
*/
@TableField(value = "current_project_volume")
private BigDecimal currentProjectVolume;
/**
* 推送工程量
*/
@TableField(value = "submit_project_volume")
private BigDecimal submitProjectVolume;
/**
* 年月
*/
@TableField(value = "`month`")
private String month;
/**
* 推送时间
*/
@TableField(value = "push_time")
private Date pushTime;
/**
* 推送数据json
*/
@TableField(value = "push_data_json")
private String pushDataJson;
/**
* IPM项目编码
*/
private String ipmProjectCode;
/**
* IPM合同编码
*/
private String ipmContractCode;
/**
* IPM作业编码
*/
private String ipmBizCode;
}
\ No newline at end of file
package com.dsk.cscec.domain.bo;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
@Data
public class CbCostMeasureActualSaveBo {
/**
* 主键
*/
private Long id;
/**
* 计划成本措施费id
*/
@TableField(value = "plan_measure_id")
private Long planMeasureId;
/**
* 本月发生成本比例
*/
@TableField(value = "month_cost_rate")
private BigDecimal monthCostRate;
/**
* 成本合价
*/
@TableField(value = "cost_effective")
private BigDecimal costEffective;
/**
* 截止本月工程量
*/
@TableField(value = "current_project_volume")
private BigDecimal currentProjectVolume;
/**
* 推送工程量
*/
@TableField(value = "submit_project_volume")
private BigDecimal submitProjectVolume;
/**
* 年月
*/
@TableField(value = "`month`")
private String month;
/**
* 推送时间
*/
@TableField(value = "push_time")
private Date pushTime;
/**
* 推送数据json
*/
@TableField(value = "push_data_json")
private String pushDataJson;
/**
* 修改人
*/
@TableField(value = "update_user")
private String updateUser;
/**
* 修改人id
*/
@TableField(value = "update_id")
private String updateId;
}
\ No newline at end of file
package com.dsk.cscec.domain.vo;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
@Data
public class CbCostMeasureActualVo {
/**
* 主键id
*/
private Long id;
/**
* 序号
*/
private String number;
/**
* 清单内容
*/
private String itemContent; // 清单内容
/**
* 工作内容
*/
private String workContent; // 工作内容、做法/规格型号/施工现场配置说明
/**
* 单位
*/
private String unit; // 单位
/**
* 工程量
*/
private BigDecimal quantity; // 工程量
/**
* 不含税单价
*/
private String unitPriceExcludingTax; // 不含税单价
/**
* 使用时间
*/
private String usageTime; // 使用时间
/**
* 不含税合价
*/
private String amountExcludingTax; //
/**
* 税率(%)
*/
private String taxRate; // 税率(%)
/**
* 含税合价
*/
private String amountIncludingTax; //
/**
* 摊销比例(%)
*/
private String amortizationRatio; //
/**
* 摊销后不含税合价
*/
private String amountExcludeTaxAmortized; //
/**
* 摊销后含税合价
*/
private String amountIncludeTaxAmortized; //
/**
* 税金(元)
*/
private String taxAmount; //
/**
* 备注
*/
private String remarks; //
/**
* 成本科目
*/
private String costSubject; // 成本科目
/**
* 税金类型
*/
private String taxType; //
/**
* 计划成本措施费id
*/
private Long planMeasureId;
/**
* 本月发生成本比例
*/
private BigDecimal monthCostRate;
/**
* 成本合价
*/
private BigDecimal costEffective;
/**
* 截止本月工程量
*/
private BigDecimal currentProjectVolume;
/**
* 推送工程量
*/
private BigDecimal submitProjectVolume;
/**
* 年月
*/
private String month;
/**
* 推送时间
*/
private Date pushTime;
/**
* 修改人
*/
@TableField(value = "update_user")
private String updateUser;
/**
* 修改人id
*/
@TableField(value = "update_id")
private String updateId;
/**
* 创建时间
*/
@TableField(value = "create_time")
private Date createTime;
/**
* 更新时间
*/
@TableField(value = "update_time")
private Date updateTime;
public static final String COL_ID = "id";
public static final String COL_PLAN_MEASURE_ID = "plan_measure_id";
public static final String COL_MONTH_COST_RATE = "month_cost_rate";
public static final String COL_COST_EFFECTIVE = "cost_effective";
public static final String COL_CURRENT_PROJECT_VOLUME = "current_project_volume";
public static final String COL_SUBMIT_PROJECT_VOLUME = "submit_project_volume";
public static final String COL_MONTH = "month";
public static final String COL_PUSH_TIME = "push_time";
public static final String COL_PUSH_DATA_JSON = "push_data_json";
public static final String COL_DEL_FLAG = "del_flag";
public static final String COL_UPDATE_USER = "update_user";
public static final String COL_UPDATE_ID = "update_id";
public static final String COL_CREATE_TIME = "create_time";
public static final String COL_UPDATE_TIME = "update_time";
}
\ No newline at end of file
package com.dsk.cscec.domain.vo;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
/**
* 措施费导入数据
*
* @author tanyang
* @create 2024-02-04 13:49
**/
@Data
public class CbCostMeasuresImportVo {
@ExcelProperty(value = "序号")
private String number; // 清单内容
@ExcelProperty(value = "清单内容")
private String itemContent; // 清单内容
@ExcelProperty(value = "工作内容")
private String workContent; // 工作内容、做法/规格型号/施工现场配置说明
@ExcelProperty(value = "单位")
private String unit; // 单位
@ExcelProperty(value = "工程量")
private BigDecimal quantity; // 工程量
@ExcelProperty(value = "不含税单价")
private String unitPriceExcludingTax; // 不含税单价
@ExcelProperty(value = "使用时间")
private String usageTime; // 使用时间
@ExcelProperty(value = "不含税合价")
private String amountExcludingTax; // 不含税合价
@ExcelProperty(value = "税率(%)")
private String taxRate; // 税率(%)
@ExcelProperty(value = "含税合价")
private String amountIncludingTax; // 含税合价
@ExcelProperty(value = "摊销比例(%)")
private String amortizationRatio; // 摊销比例(%)
@ExcelProperty(value = "摊销后不含税合价")
private String amountExcludeTaxAmortized; // 摊销后不含税合价
@ExcelProperty(value = "摊销后含税合价")
private String amountIncludeTaxAmortized; // 摊销后含税合价
@ExcelProperty(value = "税金(元)")
private String taxAmount; // 税金(元)
@ExcelProperty(value = "备注")
private String remarks; // 备注
@ExcelProperty(value = "成本科目")
private String costSubject; // 成本科目
@ExcelProperty(value = "税金类型")
private String taxType; // 税金类型
// @ExcelProperty(value = "主键")
private Long id; // 主键
// @ExcelProperty(value = "项目ID")
private Long cbProjectId; // 项目ID
private Long parentId; // 父项id
private Integer level; // 层级数
private String no; // 处理后内容
}
package com.dsk.cscec.domain.vo;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data;
import java.math.BigDecimal;
/**
* 措施费导入数据
*
* @author tanyang
* @create 2024-02-04 13:49
**/
@Data
public class CbCostMeasuresItemVo {
private String itemContent; // 清单内容
private Long id; // 主键
}
package com.dsk.cscec.domain.vo;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data;
import java.math.BigDecimal;
/**
* 措施费导入数据
*
* @author tanyang
* @create 2024-02-04 13:49
**/
@Data
public class CbProjectExpenseSummaryImportVo {
@ExcelProperty(value = "名称")
private String expenseName; // 名称
@ExcelProperty(value = "数值")
private String expenseValue; // 数值
@ExcelProperty(value = "占比")
private String proportion; // 占比
// @ExcelProperty(value = "序号")
private String number; // 清单内容
private Long id; // 主键
private Long cbProjectId; // 项目ID
private Long parentId; // 父项id
private Integer dataType; // 数据类型(0:现场经费、1:其他费用、2:措施费)
private String no; // 处理后内容
}
package com.dsk.cscec.listener;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.convert.Convert;
import cn.hutool.core.util.ReUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
import com.dsk.common.excel.ExcelListener;
import com.dsk.common.excel.ExcelResult;
import com.dsk.common.exception.ServiceException;
import com.dsk.common.helper.LoginHelper;
import com.dsk.common.utils.spring.SpringUtils;
import com.dsk.cscec.domain.CbProjectExpenseSummary;
import com.dsk.cscec.domain.vo.CbCostMeasuresImportVo;
import com.dsk.cscec.domain.vo.CbProjectExpenseSummaryImportVo;
import com.dsk.cscec.service.CbProjectExpenseSummaryService;
import com.dsk.cscec.service.impl.CbCostMeasureServiceImpl;
import lombok.extern.slf4j.Slf4j;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Pattern;
/**
* 系统用户自定义导入
*
* @author Lion Li
*/
@Slf4j
public class ProjectCostMeasureSummaryImportListener extends AnalysisEventListener<CbProjectExpenseSummaryImportVo> implements ExcelListener<CbProjectExpenseSummaryImportVo> {
private final CbProjectExpenseSummaryService cbProjectExpenseSummaryService;
//
// private final String password;
private final Long projectId;
private final Integer cbStage;
private final Integer dataType;
private List<CbProjectExpenseSummaryImportVo> dataList = new ArrayList<>();
// private final String operName;
private int successNum = 0;
private int failureNum = 0;
private final StringBuilder successMsg = new StringBuilder();
private final StringBuilder failureMsg = new StringBuilder();
public ProjectCostMeasureSummaryImportListener(Long projectId, Integer cbStage,Integer dataType) {
this.cbProjectExpenseSummaryService = SpringUtils.getBean(CbProjectExpenseSummaryService.class);
this.cbStage = cbStage;
this.projectId = projectId;
this.dataType=dataType;
}
@Override
public void invoke(CbProjectExpenseSummaryImportVo importVo, AnalysisContext context) {
CbProjectExpenseSummary cbProjectExpenseSummary=new CbProjectExpenseSummary();
BeanUtil.copyProperties(importVo,cbProjectExpenseSummary);
cbProjectExpenseSummary.setProjectId(projectId);
cbProjectExpenseSummary.setCbStage(cbStage);
cbProjectExpenseSummary.setDataType(dataType);
cbProjectExpenseSummary.setCreateBy(LoginHelper.getUsername());
cbProjectExpenseSummaryService.save(cbProjectExpenseSummary);
}
@Override
public void doAfterAllAnalysed(AnalysisContext context) {
}
@Override
public ExcelResult<CbProjectExpenseSummaryImportVo> getExcelResult() {
return new ExcelResult<CbProjectExpenseSummaryImportVo>() {
@Override
public String getAnalysis() {
if (failureNum > 0) {
failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:");
throw new ServiceException(failureMsg.toString());
} else {
successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:");
}
return successMsg.toString();
}
@Override
public List<CbProjectExpenseSummaryImportVo> getList() {
return dataList;
}
@Override
public List<String> getErrorList() {
return null;
}
};
}
}
package com.dsk.cscec.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.dsk.cscec.domain.CbCostMeasureActual;
import com.dsk.cscec.domain.bo.CbCostMeasureActualBo;
import com.dsk.cscec.domain.vo.CbCostMeasureActualVo;
import java.util.List;
public interface CbCostMeasureActualMapper extends BaseMapper<CbCostMeasureActual> {
int insertSelective(CbCostMeasureActual record);
int updateByPrimaryKeySelective(CbCostMeasureActual record);
List<CbCostMeasureActualVo> selectDataList(CbCostMeasureActualBo costMeasureActualBo);
}
\ No newline at end of file
package com.dsk.cscec.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.dsk.common.core.domain.entity.SysDictData;
import com.dsk.cscec.domain.CbCostMeasure;
import com.dsk.cscec.domain.CbQuantitySummary;
import com.dsk.cscec.domain.bo.CbCostMeasureActualBo;
import com.dsk.cscec.domain.vo.CbCostMeasureActualVo;
import java.util.List;
public interface CbCostMeasureMapper extends BaseMapper<CbCostMeasure> {
List<CbCostMeasureActualVo> selectListByProjectAndNo(CbCostMeasureActualBo cbCostMeasure);
}
\ No newline at end of file
package com.dsk.cscec.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.dsk.cscec.domain.CbCostMeasure;
import com.dsk.cscec.domain.CbCostMeasureActual;
import com.dsk.cscec.domain.bo.CbCostMeasureActualBo;
import com.dsk.cscec.domain.bo.CbCostMeasureActualSaveBo;
import com.dsk.cscec.domain.vo.CbCostMeasureActualVo;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
import java.util.Map;
/**
* 成本-工料汇总基本表(CbQuantitySummary)表服务接口
*
* @author lcl
* @since 2024-02-05 11:06:56
*/
public interface ICbCostMeasureActualService extends IService<CbCostMeasureActual> {
}
package com.dsk.cscec.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.dsk.common.core.domain.PageQuery;
import com.dsk.common.core.domain.entity.SysDictData;
import com.dsk.common.core.page.TableDataInfo;
import com.dsk.cscec.domain.CbCostMeasure;
import com.dsk.cscec.domain.bo.CbCostMeasureActualBo;
import com.dsk.cscec.domain.bo.CbCostMeasureActualPushBo;
import com.dsk.cscec.domain.bo.CbCostMeasureActualSaveBo;
import com.dsk.cscec.domain.vo.CbCostMeasureActualVo;
import com.dsk.cscec.domain.vo.CbCostMeasuresItemVo;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
import java.util.Map;
/**
* 成本-工料汇总基本表(CbQuantitySummary)表服务接口
*
* @author lcl
* @since 2024-02-05 11:06:56
*/
public interface ICbCostMeasureService extends IService<CbCostMeasure> {
void importExcelData(MultipartFile file, Long projectId);
List<Map<String, Object>> listByLevel(Long projectId, int i);
List<CbCostMeasureActualVo> selectDataList(CbCostMeasureActualBo cbCostMeasure);
void saveBatchCostMeasureActual(List<CbCostMeasureActualSaveBo> boList);
void pushCostMeasureActual(CbCostMeasureActualPushBo pushBo);
void importExcelSummaryData(MultipartFile file, Long projectId,Integer dataType);
}
package com.dsk.cscec.service.impl;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.dsk.cscec.domain.CbProjectExpenseSummary;
import com.dsk.cscec.mapper.CbProjectExpenseSummaryMapper;
import com.dsk.cscec.service.CbProjectExpenseSummaryService;
@Service
public class CbProjectExpenseSummaryServiceImpl extends ServiceImpl<CbProjectExpenseSummaryMapper, CbProjectExpenseSummary> implements CbProjectExpenseSummaryService{
}
package com.dsk.cscec.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.dsk.cscec.domain.CbCostMeasure;
import com.dsk.cscec.domain.CbCostMeasureActual;
import com.dsk.cscec.mapper.CbCostMeasureActualMapper;
import com.dsk.cscec.mapper.CbCostMeasureMapper;
import com.dsk.cscec.service.ICbCostMeasureActualService;
import org.springframework.stereotype.Service;
/**
* @author tanyang
* @create 2024-02-07 9:38
**/
@Service
public class ICbCostMeasureActualServiceImpl extends ServiceImpl<CbCostMeasureActualMapper, CbCostMeasureActual> implements ICbCostMeasureActualService {
}
<?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.dsk.cscec.mapper.CbCostMeasureActualMapper">
<resultMap id="BaseResultMap" type="com.dsk.cscec.domain.CbCostMeasureActual">
<!--@mbg.generated-->
<!--@Table cb_cost_measure_actual-->
<id column="id" jdbcType="BIGINT" property="id" />
<result column="plan_measure_id" jdbcType="BIGINT" property="planMeasureId" />
<result column="month_cost_rate" jdbcType="DECIMAL" property="monthCostRate" />
<result column="cost_effective" jdbcType="DECIMAL" property="costEffective" />
<result column="current_project_volume" jdbcType="DECIMAL" property="currentProjectVolume" />
<result column="submit_project_volume" jdbcType="DECIMAL" property="submitProjectVolume" />
<result column="month" jdbcType="VARCHAR" property="month" />
<result column="push_time" jdbcType="TIMESTAMP" property="pushTime" />
<result column="push_data_json" jdbcType="LONGVARCHAR" property="pushDataJson" />
<result column="del_flag" jdbcType="INTEGER" property="delFlag" />
<result column="update_user" jdbcType="VARCHAR" property="updateUser" />
<result column="update_id" jdbcType="VARCHAR" property="updateId" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, plan_measure_id, month_cost_rate, cost_effective, current_project_volume, submit_project_volume,
`month`, push_time, push_data_json, del_flag, update_user, update_id, create_time,
update_time
</sql>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.dsk.cscec.domain.CbCostMeasureActual" useGeneratedKeys="true">
<!--@mbg.generated-->
insert into cb_cost_measure_actual
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="planMeasureId != null">
plan_measure_id,
</if>
<if test="monthCostRate != null">
month_cost_rate,
</if>
<if test="costEffective != null">
cost_effective,
</if>
<if test="currentProjectVolume != null">
current_project_volume,
</if>
<if test="submitProjectVolume != null">
submit_project_volume,
</if>
<if test="month != null">
`month`,
</if>
<if test="pushTime != null">
push_time,
</if>
<if test="pushDataJson != null">
push_data_json,
</if>
<if test="delFlag != null">
del_flag,
</if>
<if test="updateUser != null">
update_user,
</if>
<if test="updateId != null">
update_id,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="planMeasureId != null">
#{planMeasureId,jdbcType=BIGINT},
</if>
<if test="monthCostRate != null">
#{monthCostRate,jdbcType=DECIMAL},
</if>
<if test="costEffective != null">
#{costEffective,jdbcType=DECIMAL},
</if>
<if test="currentProjectVolume != null">
#{currentProjectVolume,jdbcType=DECIMAL},
</if>
<if test="submitProjectVolume != null">
#{submitProjectVolume,jdbcType=DECIMAL},
</if>
<if test="month != null">
#{month,jdbcType=VARCHAR},
</if>
<if test="pushTime != null">
#{pushTime,jdbcType=TIMESTAMP},
</if>
<if test="pushDataJson != null">
#{pushDataJson,jdbcType=LONGVARCHAR},
</if>
<if test="delFlag != null">
#{delFlag,jdbcType=INTEGER},
</if>
<if test="updateUser != null">
#{updateUser,jdbcType=VARCHAR},
</if>
<if test="updateId != null">
#{updateId,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.dsk.cscec.domain.CbCostMeasureActual">
<!--@mbg.generated-->
update cb_cost_measure_actual
<set>
<if test="planMeasureId != null">
plan_measure_id = #{planMeasureId,jdbcType=BIGINT},
</if>
<if test="monthCostRate != null">
month_cost_rate = #{monthCostRate,jdbcType=DECIMAL},
</if>
<if test="costEffective != null">
cost_effective = #{costEffective,jdbcType=DECIMAL},
</if>
<if test="currentProjectVolume != null">
current_project_volume = #{currentProjectVolume,jdbcType=DECIMAL},
</if>
<if test="submitProjectVolume != null">
submit_project_volume = #{submitProjectVolume,jdbcType=DECIMAL},
</if>
<if test="month != null">
`month` = #{month,jdbcType=VARCHAR},
</if>
<if test="pushTime != null">
push_time = #{pushTime,jdbcType=TIMESTAMP},
</if>
<if test="pushDataJson != null">
push_data_json = #{pushDataJson,jdbcType=LONGVARCHAR},
</if>
<if test="delFlag != null">
del_flag = #{delFlag,jdbcType=INTEGER},
</if>
<if test="updateUser != null">
update_user = #{updateUser,jdbcType=VARCHAR},
</if>
<if test="updateId != null">
update_id = #{updateId,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<select id="selectDataList" resultType="com.dsk.cscec.domain.vo.CbCostMeasureActualVo">
SELECT t1.plan_measure_id,
t1.month_cost_rate,
t1.cost_effective,
t1.month_cost_rate,
t1.current_project_volume,
t1.submit_project_volume,
t1.`month`,
t1.push_time
FROM cb_cost_measure t
inner JOIN cb_cost_measure_actual t1 ON t1.plan_measure_id=t.id
WHERE
t.project_id=#{projectId}
AND t.cb_stage=#{cbStage}
AND t1.`month`=#{month}
</select>
</mapper>
\ No newline at end of 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.dsk.cscec.mapper.CbCostMeasureMapper">
<resultMap id="BaseResultMap" type="com.dsk.cscec.domain.CbCostMeasure">
<!--@mbg.generated-->
<!--@Table cb_cost_measure-->
<id column="id" jdbcType="BIGINT" property="id" />
<result column="project_id" jdbcType="BIGINT" property="projectId" />
<result column="cb_stage" jdbcType="INTEGER" property="cbStage" />
<result column="parent_id" jdbcType="BIGINT" property="parentId" />
<result column="level" jdbcType="INTEGER" property="level" />
<result column="number" jdbcType="VARCHAR" property="number" />
<result column="no" jdbcType="VARCHAR" property="no" />
<result column="item_content" jdbcType="VARCHAR" property="itemContent" />
<result column="work_content" jdbcType="VARCHAR" property="workContent" />
<result column="unit" jdbcType="VARCHAR" property="unit" />
<result column="quantity" jdbcType="DECIMAL" property="quantity" />
<result column="unit_price_excluding_tax" jdbcType="VARCHAR" property="unitPriceExcludingTax" />
<result column="usage_time" jdbcType="VARCHAR" property="usageTime" />
<result column="amount_excluding_tax" jdbcType="VARCHAR" property="amountExcludingTax" />
<result column="tax_rate" jdbcType="VARCHAR" property="taxRate" />
<result column="amount_including_tax" jdbcType="VARCHAR" property="amountIncludingTax" />
<result column="amortization_ratio" jdbcType="VARCHAR" property="amortizationRatio" />
<result column="amount_exclude_tax_amortized" jdbcType="VARCHAR" property="amountExcludeTaxAmortized" />
<result column="amount_include_tax_amortized" jdbcType="VARCHAR" property="amountIncludeTaxAmortized" />
<result column="tax_amount" jdbcType="VARCHAR" property="taxAmount" />
<result column="remarks" jdbcType="VARCHAR" property="remarks" />
<result column="cost_subject" jdbcType="VARCHAR" property="costSubject" />
<result column="tax_type" jdbcType="VARCHAR" property="taxType" />
<result column="data_source" jdbcType="INTEGER" property="dataSource" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, project_id, cb_stage, parent_id, `level`, `number`, `no`,item_content, work_content,
unit, quantity, unit_price_excluding_tax, usage_time, amount_excluding_tax, tax_rate,
amount_including_tax, amortization_ratio, amount_exclude_tax_amortized, amount_include_tax_amortized,
tax_amount, remarks, cost_subject, tax_type, create_time, update_time
</sql>
<select id="selectListByProjectAndNo" resultType="com.dsk.cscec.domain.vo.CbCostMeasureActualVo">
SELECT t.*,t1.plan_measure_id,t1.month_cost_rate, t1.cost_effective, t1.current_project_volume,t1.submit_project_volume,t1.`month`,t1.push_time FROM cb_cost_measure t
left JOIN (
SELECT t1.plan_measure_id,t1.month_cost_rate, t1.cost_effective, t1.current_project_volume,t1.submit_project_volume,t1.`month`,t1.push_time FROM cb_cost_measure t
inner JOIN cb_cost_measure_actual t1 ON t1.plan_measure_id=t.id
WHERE
t.project_id=#{projectId}
AND t.cb_stage=#{cbStage}
AND t1.`month`=#{month}) t1 ON t1.plan_measure_id=t.id
WHERE
t.project_id=#{projectId}
AND t.cb_stage=#{cbStage}
AND t.`level`!=0
AND t.`no` like concat(#{id},'.%')
ORDER BY id ASC
</select>
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment