修改
This commit is contained in:
@ -0,0 +1,40 @@
|
||||
package com.xjrsoft.module.approve;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
/**
|
||||
* @title: 审批通用类
|
||||
* @Author test01
|
||||
* @Date: 2026-01-13
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Data
|
||||
public class ApproveDto<T> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 审批结果(通过C/驳回R)
|
||||
*/
|
||||
@ApiModelProperty("审批结果(通过C/驳回R)")
|
||||
private String result;
|
||||
|
||||
/**
|
||||
* 审批意见
|
||||
*/
|
||||
@ApiModelProperty("审批意见")
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 审批人
|
||||
*/
|
||||
@ApiModelProperty("审批人")
|
||||
private String approver;
|
||||
|
||||
/**
|
||||
* 操作数据
|
||||
*/
|
||||
private T data;
|
||||
}
|
||||
@ -3,6 +3,7 @@ package com.xjrsoft.module.contract.vo;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.xjrsoft.common.annotation.Trans;
|
||||
import com.xjrsoft.common.enums.TransType;
|
||||
import com.xjrsoft.common.model.base.BaseModel;
|
||||
import com.xjrsoft.module.system.vo.LngFileUploadVo;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
@ -18,7 +19,7 @@ import java.util.List;
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Data
|
||||
public class LngContractFactPageVo {
|
||||
public class LngContractFactPageVo extends BaseModel {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
|
||||
@ -102,4 +102,16 @@ public class LngPngApproPageDto extends PageInput {
|
||||
@ApiModelProperty("审批状态(XS-待销售确认/JSZ-待接收站/GD-待管道确认/YSP-已确认)")
|
||||
private String approCode;
|
||||
|
||||
/**
|
||||
* 拟稿日期开始时间
|
||||
*/
|
||||
@ApiModelProperty("计划开始时间")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime datePlanStart;
|
||||
/**
|
||||
* 拟稿日期结束时间
|
||||
*/
|
||||
@ApiModelProperty("计划结束时间")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime datePlanEnd;
|
||||
}
|
||||
|
||||
@ -2,16 +2,9 @@ package com.xjrsoft.module.dayPlan.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import com.xjrsoft.module.dayPlan.dto.AddLngPngMeasureSalesPurDto;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* @title: 表单出参
|
||||
@ -70,6 +63,12 @@ public class LngPngApproPurVo extends com.xjrsoft.common.model.base.BaseModel{
|
||||
@ApiModelProperty("供应商")
|
||||
private String suCode;
|
||||
|
||||
/**
|
||||
* 供应商
|
||||
*/
|
||||
@ApiModelProperty("供应商")
|
||||
private String suName;
|
||||
|
||||
|
||||
/**
|
||||
* 采购合同-主信息主键
|
||||
@ -77,6 +76,12 @@ public class LngPngApproPurVo extends com.xjrsoft.common.model.base.BaseModel{
|
||||
@ApiModelProperty("采购合同-主信息主键")
|
||||
private Long kpId;
|
||||
|
||||
/**
|
||||
* 采购合同名称
|
||||
*/
|
||||
@ApiModelProperty("采购合同名称")
|
||||
private Long kpName;
|
||||
|
||||
|
||||
/**
|
||||
* 合同-国内采购-管道气-上载点主键
|
||||
@ -91,6 +96,12 @@ public class LngPngApproPurVo extends com.xjrsoft.common.model.base.BaseModel{
|
||||
@ApiModelProperty("上载点")
|
||||
private String pointUpCode;
|
||||
|
||||
/**
|
||||
* 上载点
|
||||
*/
|
||||
@ApiModelProperty("上载点")
|
||||
private String pointUpName;
|
||||
|
||||
|
||||
/**
|
||||
* 接收站
|
||||
|
||||
@ -2,17 +2,11 @@ package com.xjrsoft.module.dayPlan.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
import com.xjrsoft.module.dayPlan.dto.AddLngPngMeasureSalesPurDto;
|
||||
|
||||
/**
|
||||
* @title: 表单出参
|
||||
* @Author test01
|
||||
@ -63,6 +57,12 @@ public class LngPngApproVo extends com.xjrsoft.common.model.base.BaseModel{
|
||||
@ApiModelProperty("变更标识(I/U/D对原始计划的增改删)")
|
||||
private String alterSign;
|
||||
|
||||
/**
|
||||
* 变更标识(I/U/D对原始计划的增改删)
|
||||
*/
|
||||
@ApiModelProperty("变更标识(I/U/D对原始计划的增改删)")
|
||||
private String alterName;
|
||||
|
||||
|
||||
/**
|
||||
* 计划日期
|
||||
@ -77,6 +77,18 @@ public class LngPngApproVo extends com.xjrsoft.common.model.base.BaseModel{
|
||||
@ApiModelProperty("客户编码")
|
||||
private String cuCode;
|
||||
|
||||
/**
|
||||
* 客户简称
|
||||
*/
|
||||
@ApiModelProperty("客户简称")
|
||||
private String cuSname;
|
||||
|
||||
/**
|
||||
* 客户名称
|
||||
*/
|
||||
@ApiModelProperty("客户名称")
|
||||
private String cuName;
|
||||
|
||||
|
||||
/**
|
||||
* 交易主体编码(天然气公司/惠贸)
|
||||
@ -84,6 +96,12 @@ public class LngPngApproVo extends com.xjrsoft.common.model.base.BaseModel{
|
||||
@ApiModelProperty("交易主体编码(天然气公司/惠贸)")
|
||||
private Long comId;
|
||||
|
||||
/**
|
||||
* 交易主体名称(天然气公司/惠贸)
|
||||
*/
|
||||
@ApiModelProperty("交易主体名称(天然气公司/惠贸)")
|
||||
private Long comName;
|
||||
|
||||
|
||||
/**
|
||||
* 合同-主信息主键(销售)(lng_contract)
|
||||
@ -105,6 +123,12 @@ public class LngPngApproVo extends com.xjrsoft.common.model.base.BaseModel{
|
||||
@ApiModelProperty("交割点")
|
||||
private String pointDelyCode;
|
||||
|
||||
/**
|
||||
* 交割点名称
|
||||
*/
|
||||
@ApiModelProperty("交割点名称")
|
||||
private String pointDelyName;
|
||||
|
||||
|
||||
/**
|
||||
* 自有管道沿线下载点标识(Y-是,N-否)
|
||||
@ -280,6 +304,12 @@ public class LngPngApproVo extends com.xjrsoft.common.model.base.BaseModel{
|
||||
@ApiModelProperty("审批状态(XS-待销售确认/JSZ-待接收站/GD-待管道确认/YSP-已确认)")
|
||||
private String approCode;
|
||||
|
||||
/**
|
||||
* 审批状态(XS-待销售确认/JSZ-待接收站/GD-待管道确认/YSP-已确认)
|
||||
*/
|
||||
@ApiModelProperty("审批状态(XS-待销售确认/JSZ-待接收站/GD-待管道确认/YSP-已确认)")
|
||||
private String approName;
|
||||
|
||||
|
||||
/**
|
||||
* 批复意见
|
||||
@ -352,4 +382,16 @@ public class LngPngApproVo extends com.xjrsoft.common.model.base.BaseModel{
|
||||
@ApiModelProperty("lngPngApproPur子表")
|
||||
private List<LngPngApproPurVo> lngPngApproPurList;
|
||||
|
||||
|
||||
/**
|
||||
* 标记
|
||||
*/
|
||||
@ApiModelProperty("标记")
|
||||
private String daysSign;
|
||||
|
||||
/**
|
||||
* 合同
|
||||
*/
|
||||
@ApiModelProperty("合同")
|
||||
private String kName;
|
||||
}
|
||||
|
||||
@ -3,6 +3,7 @@ package com.xjrsoft.module.sales.vo;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.xjrsoft.common.annotation.Trans;
|
||||
import com.xjrsoft.common.enums.TransType;
|
||||
import com.xjrsoft.common.model.base.BaseModel;
|
||||
import com.xjrsoft.module.system.vo.LngFileUploadVo;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
@ -16,7 +17,7 @@ import java.util.List;
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Data
|
||||
public class LngApproPageVo {
|
||||
public class LngApproPageVo extends BaseModel {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
|
||||
@ -1,24 +1,22 @@
|
||||
package com.xjrsoft.module.dayPlan.controller;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.xjrsoft.common.page.ConventPage;
|
||||
import com.xjrsoft.common.page.PageOutput;
|
||||
import com.xjrsoft.common.model.result.R;
|
||||
import com.xjrsoft.common.utils.VoToColumnUtil;
|
||||
import com.xjrsoft.module.dayPlan.dto.UpdateLngPngApproDto;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
|
||||
import com.xjrsoft.module.dayPlan.dto.LngPngApproPageDto;
|
||||
import com.xjrsoft.module.dayPlan.entity.LngPngAppro;
|
||||
import com.xjrsoft.module.dayPlan.service.IPngApproService;
|
||||
import com.xjrsoft.module.dayPlan.vo.LngPngApproPageVo;
|
||||
import com.xjrsoft.module.datalog.vo.DataChangeLogVo;
|
||||
import com.google.api.client.util.Lists;
|
||||
import com.pictc.datalog.DataOperationContent;
|
||||
import com.pictc.datalog.DataOperationListener;
|
||||
import com.pictc.enums.BusinessCode;
|
||||
import com.pictc.enums.ExceptionCommonCode;
|
||||
import com.pictc.jdbc.JdbcTools;
|
||||
import com.pictc.jdbc.model.JdbcParam;
|
||||
import com.pictc.utils.StringUtils;
|
||||
import com.xjrsoft.common.exception.BusinessException;
|
||||
import com.xjrsoft.common.model.result.R;
|
||||
import com.xjrsoft.module.approve.ApproveDto;
|
||||
import com.xjrsoft.module.datalog.service.DatalogService;
|
||||
import com.xjrsoft.module.dayPlan.vo.LngPngApproVo;
|
||||
import com.xjrsoft.module.datalog.vo.DataChangeLogVo;
|
||||
import com.xjrsoft.module.dayPlan.dto.LngPngApproPageDto;
|
||||
import com.xjrsoft.module.dayPlan.dto.UpdateLngPngApproDto;
|
||||
import com.xjrsoft.module.dayPlan.service.IPngApproService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.AllArgsConstructor;
|
||||
@ -43,43 +41,18 @@ public class PngApproController {
|
||||
private final IPngApproService pngApproService;
|
||||
private final DatalogService dataService;
|
||||
|
||||
@GetMapping(value = "/page")
|
||||
// @GetMapping(value = "/page")
|
||||
@ApiOperation(value="LngPngAppro列表(分页)")
|
||||
@SaCheckPermission("pngAppro:list")
|
||||
public R page(@Valid LngPngApproPageDto dto){
|
||||
|
||||
LambdaQueryWrapper<LngPngAppro> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper
|
||||
.eq(ObjectUtil.isNotNull(dto.getId()),LngPngAppro::getId,dto.getId())
|
||||
.like(StrUtil.isNotBlank(dto.getCuCode()),LngPngAppro::getCuCode,dto.getCuCode())
|
||||
.eq(ObjectUtil.isNotNull(dto.getDemandId()),LngPngAppro::getDemandId,dto.getDemandId())
|
||||
.eq(ObjectUtil.isNotNull(dto.getQtyDemandGj()),LngPngAppro::getQtyDemandGj,dto.getQtyDemandGj())
|
||||
.eq(ObjectUtil.isNotNull(dto.getQtyDemandM3()),LngPngAppro::getQtyDemandM3,dto.getQtyDemandM3())
|
||||
.eq(ObjectUtil.isNotNull(dto.getQtySalesGj()),LngPngAppro::getQtySalesGj,dto.getQtySalesGj())
|
||||
.eq(ObjectUtil.isNotNull(dto.getQtySalesM3()),LngPngAppro::getQtySalesM3,dto.getQtySalesM3())
|
||||
.eq(ObjectUtil.isNotNull(dto.getRateK()),LngPngAppro::getRateK,dto.getRateK())
|
||||
.eq(ObjectUtil.isNotNull(dto.getRateMp()),LngPngAppro::getRateMp,dto.getRateMp())
|
||||
.eq(ObjectUtil.isNotNull(dto.getRateS()),LngPngAppro::getRateS,dto.getRateS())
|
||||
.like(StrUtil.isNotBlank(dto.getLastVerSign()),LngPngAppro::getLastVerSign,dto.getLastVerSign())
|
||||
.like(StrUtil.isNotBlank(dto.getAlterSign()),LngPngAppro::getAlterSign,dto.getAlterSign())
|
||||
.like(StrUtil.isNotBlank(dto.getNote()),LngPngAppro::getNote,dto.getNote())
|
||||
.like(StrUtil.isNotBlank(dto.getApproCode()),LngPngAppro::getApproCode,dto.getApproCode())
|
||||
.orderByDesc(LngPngAppro::getId)
|
||||
.select(LngPngAppro.class,x -> VoToColumnUtil.fieldsToColumns(LngPngApproPageVo.class).contains(x.getProperty()));
|
||||
IPage<LngPngAppro> page = pngApproService.page(ConventPage.getPage(dto), queryWrapper);
|
||||
PageOutput<LngPngApproPageVo> pageOutput = ConventPage.getPageOutput(page, LngPngApproPageVo.class);
|
||||
return R.ok(pageOutput);
|
||||
return R.ok(pngApproService.queryPage(dto));
|
||||
}
|
||||
|
||||
@GetMapping(value = "/info")
|
||||
@ApiOperation(value="根据id查询LngPngAppro信息")
|
||||
@SaCheckPermission("pngAppro:detail")
|
||||
public R info(@RequestParam Long id){
|
||||
LngPngAppro lngPngAppro = pngApproService.getByIdDeep(id);
|
||||
if (lngPngAppro == null) {
|
||||
return R.error("找不到此数据!");
|
||||
}
|
||||
return R.ok(BeanUtil.toBean(lngPngAppro, LngPngApproVo.class));
|
||||
return R.ok(pngApproService.getInfoById(id));
|
||||
}
|
||||
|
||||
@GetMapping(value = "/datalog")
|
||||
@ -90,6 +63,29 @@ public class PngApproController {
|
||||
return R.ok(logs);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "销售审批")
|
||||
@PostMapping(value = "/approveXS")
|
||||
@SaCheckPermission("pngAppro:approveXS")
|
||||
public R approveXS(@Valid @RequestBody ApproveDto<UpdateLngPngApproDto> dto){
|
||||
pngApproService.approve(dto);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "管道审批")
|
||||
@PostMapping(value = "/approveGD")
|
||||
@SaCheckPermission("pngAppro:approveGD")
|
||||
public R approveGD(@Valid @RequestBody ApproveDto<UpdateLngPngApproDto> dto){
|
||||
pngApproService.approve(dto);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "接收站审批")
|
||||
@PostMapping(value = "/approveJSZ")
|
||||
@SaCheckPermission("pngAppro:approveJSZ")
|
||||
public R approveJSZ(@Valid @RequestBody ApproveDto<UpdateLngPngApproDto> dto){
|
||||
pngApproService.approve(dto);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@ApiOperation(value = "新增LngPngAppro")
|
||||
@ -103,7 +99,30 @@ public class PngApproController {
|
||||
@ApiOperation(value = "修改LngPngAppro")
|
||||
@SaCheckPermission("pngAppro:edit")
|
||||
public R update(@Valid @RequestBody UpdateLngPngApproDto dto){
|
||||
return R.ok(dataService.updateById(dto));
|
||||
return R.ok(dataService.updateById(dto, new DataOperationListener<UpdateLngPngApproDto>() {
|
||||
@Override
|
||||
public UpdateLngPngApproDto before(DataOperationContent<UpdateLngPngApproDto> content) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UpdateLngPngApproDto after(DataOperationContent<UpdateLngPngApproDto> content) {
|
||||
String sql = StringUtils.format("{? = call pc_{0}.f_approval(?, ?, ?, ?, ?)}",
|
||||
content.getTableName());
|
||||
List<JdbcParam> params = Lists.newArrayList();
|
||||
JdbcParam outParam = JdbcParam.ofString(null).setOut(true);
|
||||
params.add(outParam);
|
||||
params.add(JdbcParam.ofLong(content.getIdValue()));
|
||||
params.add(JdbcParam.ofString("XS"));
|
||||
params.add(JdbcParam.ofString("XS"));
|
||||
JdbcTools.call(sql,params);
|
||||
String error = outParam.getStringValue();
|
||||
if (StringUtils.isNotEmpty(error)) {
|
||||
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DB_FUNCTION_DELETE_EXEC_ERROR, error));
|
||||
}
|
||||
return content.getObj();
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
|
||||
@ -1,8 +1,18 @@
|
||||
package com.xjrsoft.module.dayPlan.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import com.xjrsoft.module.dayPlan.dto.LngPngApproPageDto;
|
||||
import com.xjrsoft.module.dayPlan.entity.LngPngAppro;
|
||||
import com.xjrsoft.module.dayPlan.vo.LngPngApproPurVo;
|
||||
import com.xjrsoft.module.dayPlan.vo.LngPngApproVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @title: mapper
|
||||
@ -13,4 +23,58 @@ import org.apache.ibatis.annotations.Mapper;
|
||||
@Mapper
|
||||
public interface LngPngApproMapper extends MPJBaseMapper<LngPngAppro> {
|
||||
|
||||
@Select("SELECT a.id, a.rule_user_id, a.demand_org_id, a.date_plan, " +
|
||||
" (CASE a.date_plan - CURRENT_DATE " +
|
||||
" WHEN 0 THEN '当日' " +
|
||||
" WHEN 1 THEN '次日' " +
|
||||
" ELSE IF(a.date_plan - CURRENT_DATE < 0,'',a.date_plan - CURRENT_DATE || '日后') " +
|
||||
" END) days_sign" +
|
||||
" a.cu_code, cu.cu_name, cu.cu_sname, a.ver_no, a.point_dely_code, sp.full_name AS poin_dely_name," +
|
||||
" a.qty_demand_gj, a.qty_demand_m3/10000 AS qty_demand_m3," +
|
||||
" a.qty_sales_gj, a.qty_sales_m3/10000 AS qty_sales_m3," +
|
||||
" a.rate_k, a.rate_mp, a.rate_s, k.k_name, a.alter_sign, dd_iud.name AS alter_name," +
|
||||
" a.com_id, com.name AS com_name, a.appro_code, dd_a.name as appro_name, a.reply, a.note" +
|
||||
" FROM lng_png_appro a" +
|
||||
" LEFT JOIN lng_customer cu ON cu.cu_code=a.cu_code" +
|
||||
" LEFT JOIN lng_contract k ON k.id=a.ks_id" +
|
||||
" LEFT JOIN xjr_dictionary_item di_iud on di_iud.code='LNG_ALTER'" +
|
||||
" LEFT JOIN xjr_dictionary_detail dd_iud on dd_iud.item_id=di_iud.id AND dd_iud.code=a.alter_sign" +
|
||||
" LEFT JOIN xjr_dictionary_item di_a on di_a.code='LNG_APPRO1'" +
|
||||
" LEFT JOIN xjr_dictionary_detail dd_a on dd_a.item_id=di_a.id AND dd_a.code=a.appro_code" +
|
||||
" LEFT JOIN lng_b_station_png sp ON sp.code=a.point_dely_code" +
|
||||
" LEFT JOIN xjr_department com ON com.id=a.com_id" +
|
||||
" WHERE a.last_ver_sign='Y'" +
|
||||
" ${ew.customSqlSegment}" +
|
||||
" ORDER BY a.date_plan DESC, (CASE a.appro_code WHEN 'XS' THEN 1 WHEN 'JSZ' THEN 2 WHEN 'GD' THEN 3 WHEN 'YSP' THEN 4 ELSE 5 END) , cu.cu_sname")
|
||||
IPage<LngPngApproVo> queryPage(IPage<LngPngApproPageDto> page, @Param(Constants.WRAPPER) QueryWrapper<LngPngAppro> queryWrapper);
|
||||
|
||||
@Select("SELECT a.*," +
|
||||
" (CASE a.date_plan - CURRENT_DATE " +
|
||||
" WHEN 0 THEN '当日' " +
|
||||
" WHEN 1 THEN '次日' " +
|
||||
" ELSE IF(a.date_plan - CURRENT_DATE < 0,'',a.date_plan - CURRENT_DATE || '日后') " +
|
||||
" END) days_sign," +
|
||||
" cu.cu_name, cu.cu_sname, sp.full_name AS poin_dely_name," +
|
||||
" k.k_name, dd_iud.name AS alter_name," +
|
||||
" com.name AS com_name, dd_a.name as appro_name" +
|
||||
" FROM lng_png_appro a" +
|
||||
" LEFT JOIN lng_customer cu ON cu.cu_code=a.cu_code" +
|
||||
" LEFT JOIN lng_contract k ON k.id=a.ks_id" +
|
||||
" LEFT JOIN xjr_dictionary_item di_iud on di_iud.code='LNG_ALTER'" +
|
||||
" LEFT JOIN xjr_dictionary_detail dd_iud on dd_iud.item_id=di_iud.id AND dd_iud.code=a.alter_sign" +
|
||||
" LEFT JOIN xjr_dictionary_item di_a on di_a.code='LNG_APPRO1'" +
|
||||
" LEFT JOIN xjr_dictionary_detail dd_a on dd_a.item_id=di_a.id AND dd_a.code=a.appro_code" +
|
||||
" LEFT JOIN lng_b_station_png sp ON sp.code=a.point_dely_code" +
|
||||
" LEFT JOIN xjr_department com ON com.id=a.com_id" +
|
||||
" WHERE a.id = #{id}")
|
||||
LngPngApproVo getOneById(@Param("id") Long id);
|
||||
|
||||
@Select("SELECT a.*, su.su_name, k.k_name AS kp_name, sp.full_name AS point_up_name" +
|
||||
" FROM lng_png_appro_pur a" +
|
||||
" LEFT JOIN lng_supplier su ON su.su_code=a.su_code" +
|
||||
" LEFT JOIN lng_contract k ON k.id=a.kp_id" +
|
||||
" LEFT JOIN lng_b_station_png sp ON sp.code=a.point_up_code" +
|
||||
" WHERE a.appro_id = #{id}" +
|
||||
" ORDER BY a.sort")
|
||||
List<LngPngApproPurVo> queryLngPngApproPurList(@Param("id")Long id);
|
||||
}
|
||||
|
||||
@ -3,9 +3,15 @@ package com.xjrsoft.module.dayPlan.service;
|
||||
import com.github.yulichang.base.MPJBaseService;
|
||||
import com.github.yulichang.extension.mapping.base.MPJDeepService;
|
||||
import com.github.yulichang.extension.mapping.base.MPJRelationService;
|
||||
import com.xjrsoft.common.page.PageOutput;
|
||||
import com.xjrsoft.module.approve.ApproveDto;
|
||||
import com.xjrsoft.module.dayPlan.dto.LngPngApproPageDto;
|
||||
import com.xjrsoft.module.dayPlan.dto.UpdateLngPngApproDto;
|
||||
import com.xjrsoft.module.dayPlan.entity.LngPngAppro;
|
||||
import com.xjrsoft.module.dayPlan.vo.LngPngApproPageVo;
|
||||
import com.xjrsoft.module.dayPlan.vo.LngPngApproVo;
|
||||
|
||||
import java.util.List;
|
||||
import javax.validation.Valid;
|
||||
|
||||
/**
|
||||
* @title: service
|
||||
@ -15,27 +21,10 @@ import java.util.List;
|
||||
*/
|
||||
|
||||
public interface IPngApproService extends MPJBaseService<LngPngAppro>, MPJDeepService<LngPngAppro>, MPJRelationService<LngPngAppro> {
|
||||
/**
|
||||
* 新增
|
||||
*
|
||||
* @param lngPngAppro
|
||||
* @return
|
||||
*/
|
||||
Boolean add(LngPngAppro lngPngAppro);
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param lngPngAppro
|
||||
* @return
|
||||
*/
|
||||
Boolean update(LngPngAppro lngPngAppro);
|
||||
PageOutput<LngPngApproPageVo> queryPage(@Valid LngPngApproPageDto dto);
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
Boolean delete(List<Long> ids);
|
||||
LngPngApproVo getInfoById(Long id);
|
||||
|
||||
void approve(@Valid ApproveDto<UpdateLngPngApproDto> dto);
|
||||
}
|
||||
|
||||
@ -1,19 +1,39 @@
|
||||
package com.xjrsoft.module.dayPlan.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import cn.dev33.satoken.session.SaSession;
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.github.yulichang.base.MPJBaseServiceImpl;
|
||||
import com.google.api.client.util.Lists;
|
||||
import com.pictc.enums.BusinessCode;
|
||||
import com.pictc.enums.ExceptionCommonCode;
|
||||
import com.pictc.jdbc.JdbcTools;
|
||||
import com.pictc.jdbc.model.JdbcParam;
|
||||
import com.xjrsoft.common.constant.GlobalConstant;
|
||||
import com.xjrsoft.common.exception.BusinessException;
|
||||
import com.xjrsoft.common.page.ConventPage;
|
||||
import com.xjrsoft.common.page.PageOutput;
|
||||
import com.xjrsoft.module.approve.ApproveDto;
|
||||
import com.xjrsoft.module.dayPlan.dto.LngPngApproPageDto;
|
||||
import com.xjrsoft.module.dayPlan.dto.UpdateLngPngApproDto;
|
||||
import com.xjrsoft.module.dayPlan.dto.UpdateLngPngApproPurDto;
|
||||
import com.xjrsoft.module.dayPlan.entity.LngPngAppro;
|
||||
import com.xjrsoft.module.dayPlan.entity.LngPngApproPur;
|
||||
import com.xjrsoft.module.dayPlan.mapper.LngPngApproMapper;
|
||||
import com.xjrsoft.module.dayPlan.mapper.LngPngApproPurMapper;
|
||||
import com.xjrsoft.module.dayPlan.service.IPngApproService;
|
||||
import com.xjrsoft.module.dayPlan.vo.LngPngApproPageVo;
|
||||
import com.xjrsoft.module.dayPlan.vo.LngPngApproPurVo;
|
||||
import com.xjrsoft.module.dayPlan.vo.LngPngApproVo;
|
||||
import com.xjrsoft.module.organization.dto.UserDto;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @title: service
|
||||
@ -24,65 +44,76 @@ import java.util.stream.Collectors;
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class PngApproServiceImpl extends MPJBaseServiceImpl<LngPngApproMapper, LngPngAppro> implements IPngApproService {
|
||||
private final LngPngApproMapper pngApproLngPngApproMapper;
|
||||
|
||||
private final LngPngApproPurMapper pngApproLngPngApproPurMapper;
|
||||
|
||||
private final LngPngApproPurMapper lngPngApproPurMapper;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean add(LngPngAppro lngPngAppro) {
|
||||
pngApproLngPngApproMapper.insert(lngPngAppro);
|
||||
for (LngPngApproPur lngPngApproPur : lngPngAppro.getLngPngApproPurList()) {
|
||||
lngPngApproPur.setApproId(lngPngAppro.getId());
|
||||
pngApproLngPngApproPurMapper.insert(lngPngApproPur);
|
||||
public PageOutput<LngPngApproPageVo> queryPage(LngPngApproPageDto dto) {
|
||||
QueryWrapper<LngPngAppro> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper
|
||||
.between(ObjectUtil.isNotNull(dto.getDatePlanStart()) && ObjectUtil.isNotNull(dto.getDatePlanEnd()),
|
||||
"a.date_plan", dto.getDatePlanStart(), dto.getDatePlanEnd())
|
||||
.and(StringUtils.isNotBlank(dto.getCuCode()), r ->
|
||||
r.like("cu.cu_code", dto.getCuCode())
|
||||
.or()
|
||||
.like("cu.cu_name", dto.getCuCode())
|
||||
.or()
|
||||
.like("cu.cu_sname", dto.getCuCode())
|
||||
)
|
||||
.eq(StringUtils.isNotBlank(dto.getApproCode()), "a.appro_code", dto.getApproCode());
|
||||
IPage<LngPngApproVo> page = this.baseMapper.queryPage(ConventPage.getPage(dto), queryWrapper);
|
||||
PageOutput<LngPngApproPageVo> pageOutput = ConventPage.getPageOutput(page, LngPngApproPageVo.class);
|
||||
return pageOutput;
|
||||
}
|
||||
|
||||
return true;
|
||||
@Override
|
||||
public LngPngApproVo getInfoById(Long id) {
|
||||
LngPngApproVo vo = this.baseMapper.getOneById(id);
|
||||
if(vo == null) {
|
||||
new BusinessException(BusinessCode.of(10500,"找不到此数据"));
|
||||
}
|
||||
List<LngPngApproPurVo> lngPngApproPurList = this.baseMapper.queryLngPngApproPurList(id);
|
||||
vo.setLngPngApproPurList(lngPngApproPurList);
|
||||
return vo;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean update(LngPngAppro lngPngAppro) {
|
||||
pngApproLngPngApproMapper.updateById(lngPngAppro);
|
||||
//********************************* LngPngApproPur 增删改 开始 *******************************************/
|
||||
{
|
||||
// 查出所有子级的id
|
||||
List<LngPngApproPur> lngPngApproPurList = pngApproLngPngApproPurMapper.selectList(Wrappers.lambdaQuery(LngPngApproPur.class).eq(LngPngApproPur::getApproId, lngPngAppro.getId()).select(LngPngApproPur::getId));
|
||||
List<Long> lngPngApproPurIds = lngPngApproPurList.stream().map(LngPngApproPur::getId).collect(Collectors.toList());
|
||||
//原有子表单 没有被删除的主键
|
||||
List<Long> lngPngApproPurOldIds = lngPngAppro.getLngPngApproPurList().stream().map(LngPngApproPur::getId).filter(Objects::nonNull).collect(Collectors.toList());
|
||||
//找到需要删除的id
|
||||
List<Long> lngPngApproPurRemoveIds = lngPngApproPurIds.stream().filter(item -> !lngPngApproPurOldIds.contains(item)).collect(Collectors.toList());
|
||||
|
||||
for (LngPngApproPur lngPngApproPur : lngPngAppro.getLngPngApproPurList()) {
|
||||
//如果不等于空则修改
|
||||
if (lngPngApproPur.getId() != null) {
|
||||
pngApproLngPngApproPurMapper.updateById(lngPngApproPur);
|
||||
public void approve(ApproveDto<UpdateLngPngApproDto> dto) {
|
||||
UpdateLngPngApproDto data = dto.getData();
|
||||
LngPngAppro lngPngAppro = this.baseMapper.selectById(data.getId());
|
||||
if(lngPngAppro == null) {
|
||||
new BusinessException(BusinessCode.of(10500,"找不到此数据"));
|
||||
}
|
||||
//如果等于空 则新增
|
||||
else {
|
||||
//已经不存在的id 删除
|
||||
lngPngApproPur.setApproId(lngPngAppro.getId());
|
||||
pngApproLngPngApproPurMapper.insert(lngPngApproPur);
|
||||
lngPngAppro.setQtySalesGj(data.getQtySalesGj());
|
||||
lngPngAppro.setQtySalesM3(data.getQtySalesM3());
|
||||
this.baseMapper.updateById(lngPngAppro);
|
||||
for (UpdateLngPngApproPurDto lngPngApproPurDto : data.getLngPngApproPurList()) {
|
||||
LngPngApproPur lngPngApproPur = lngPngApproPurMapper.selectById(lngPngApproPurDto.getId());
|
||||
if(lngPngApproPur == null) {
|
||||
new BusinessException(BusinessCode.of(10500,"找不到此数据"));
|
||||
}
|
||||
lngPngApproPur.setQtySalesGj(lngPngApproPurDto.getQtySalesGj());
|
||||
lngPngApproPur.setQtySalesM3(lngPngApproPurDto.getQtySalesM3());
|
||||
lngPngApproPur.setNote(lngPngApproPurDto.getNote());
|
||||
lngPngApproPurMapper.updateById(lngPngApproPur);
|
||||
}
|
||||
//已经不存在的id 删除
|
||||
if(lngPngApproPurRemoveIds.size() > 0){
|
||||
pngApproLngPngApproPurMapper.deleteBatchIds(lngPngApproPurRemoveIds);
|
||||
String sql = com.pictc.utils.StringUtils.format("{? = call pc_{0}.f_approval(?, ?, ?, ?, ?)}",
|
||||
"lng_png_appro");
|
||||
List<JdbcParam> params = Lists.newArrayList();
|
||||
JdbcParam outParam = JdbcParam.ofString(null).setOut(true);
|
||||
params.add(outParam);
|
||||
params.add(JdbcParam.ofLong(data.getId()));
|
||||
params.add(JdbcParam.ofString("XS"));
|
||||
params.add(JdbcParam.ofString(dto.getResult()));
|
||||
params.add(JdbcParam.ofString(dto.getRemark()));
|
||||
SaSession tokenSession = StpUtil.getTokenSession();
|
||||
UserDto user = tokenSession.get(GlobalConstant.LOGIN_USER_INFO_KEY, new UserDto());
|
||||
params.add(JdbcParam.ofLong(user.getId()));
|
||||
JdbcTools.call(sql,params);
|
||||
String error = outParam.getStringValue();
|
||||
if (com.pictc.utils.StringUtils.isNotEmpty(error)) {
|
||||
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DB_FUNCTION_DELETE_EXEC_ERROR, error));
|
||||
}
|
||||
}
|
||||
//********************************* LngPngApproPur 增删改 结束 *******************************************/
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean delete(List<Long> ids) {
|
||||
pngApproLngPngApproMapper.deleteBatchIds(ids);
|
||||
pngApproLngPngApproPurMapper.delete(Wrappers.lambdaQuery(LngPngApproPur.class).in(LngPngApproPur::getApproId, ids));
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user