优化更新
This commit is contained in:
parent
df4db628d5
commit
75fe422b6d
|
@ -1,22 +1,22 @@
|
||||||
package com.ruoyi.yh.price.domain;
|
package com.ruoyi.yh.price.domain;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import com.ruoyi.common.annotation.Excel;
|
||||||
import com.ruoyi.common.constant.DictType;
|
import com.ruoyi.common.constant.DictType;
|
||||||
import com.ruoyi.common.core.validate.ValidGroup;
|
import com.ruoyi.common.core.domain.BaseEntity;
|
||||||
import com.ruoyi.common.core.interfaces.LogBizParam;
|
import com.ruoyi.common.core.interfaces.LogBizParam;
|
||||||
|
import com.ruoyi.common.core.validate.ValidGroup;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import com.ruoyi.common.annotation.Excel;
|
import org.apache.poi.ss.usermodel.IndexedColors;
|
||||||
import com.ruoyi.common.core.domain.BaseEntity;
|
|
||||||
|
|
||||||
import javax.validation.constraints.Min;
|
import javax.validation.constraints.Min;
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
import javax.validation.constraints.Size;
|
import javax.validation.constraints.Size;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 单价对象 bst_price
|
* 单价对象 bst_price
|
||||||
|
@ -30,14 +30,14 @@ public class Price extends BaseEntity implements LogBizParam
|
||||||
{
|
{
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Excel(name = "ID")
|
@Excel(name = "ID", prompt = "必填", headerColor = IndexedColors.RED)
|
||||||
private Long priceId;
|
private Long priceId;
|
||||||
|
|
||||||
@ApiModelProperty("部门ID")
|
@ApiModelProperty("部门ID")
|
||||||
@NotNull(message = "部门不存在", groups = ValidGroup.Create.class)
|
@NotNull(message = "部门不存在", groups = ValidGroup.Create.class)
|
||||||
private Long deptId;
|
private Long deptId;
|
||||||
|
|
||||||
@Excel(name = "状态", dictType = DictType.PRICE_STATUS, comboReadDict = true)
|
@Excel(name = "状态", type = Excel.Type.EXPORT, dictType = DictType.PRICE_STATUS, comboReadDict = true, prompt = "必填", headerColor = IndexedColors.RED)
|
||||||
@ApiModelProperty("状态")
|
@ApiModelProperty("状态")
|
||||||
private String status;
|
private String status;
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ public class Price extends BaseEntity implements LogBizParam
|
||||||
@Size(max = 200, message = "大小不允许超过200个字符")
|
@Size(max = 200, message = "大小不允许超过200个字符")
|
||||||
private String size;
|
private String size;
|
||||||
|
|
||||||
@Excel(name = "工序名称")
|
@Excel(name = "工序名称", prompt = "必填", headerColor = IndexedColors.RED)
|
||||||
@ApiModelProperty("工序名称")
|
@ApiModelProperty("工序名称")
|
||||||
@NotNull(message = "工序名称不允许为空", groups = ValidGroup.Create.class)
|
@NotNull(message = "工序名称不允许为空", groups = ValidGroup.Create.class)
|
||||||
@Size(max = 200, message = "工序名称不允许超过200个字符")
|
@Size(max = 200, message = "工序名称不允许超过200个字符")
|
||||||
|
@ -72,7 +72,7 @@ public class Price extends BaseEntity implements LogBizParam
|
||||||
@Size(max = 200, message = "规格不允许超过200个字符")
|
@Size(max = 200, message = "规格不允许超过200个字符")
|
||||||
private String spec;
|
private String spec;
|
||||||
|
|
||||||
@Excel(name = "单价(元)", cellType = Excel.ColumnType.NUMERIC)
|
@Excel(name = "单价(元)", cellType = Excel.ColumnType.NUMERIC, prompt = "必填", headerColor = IndexedColors.RED)
|
||||||
@ApiModelProperty("单价")
|
@ApiModelProperty("单价")
|
||||||
@NotNull(message = "单价不允许为空", groups = ValidGroup.Create.class)
|
@NotNull(message = "单价不允许为空", groups = ValidGroup.Create.class)
|
||||||
@Min(value = 0, message = "单价不允许小于0元")
|
@Min(value = 0, message = "单价不允许小于0元")
|
||||||
|
@ -106,7 +106,7 @@ public class Price extends BaseEntity implements LogBizParam
|
||||||
@ApiModelProperty("更新人ID")
|
@ApiModelProperty("更新人ID")
|
||||||
private Long updateId;
|
private Long updateId;
|
||||||
|
|
||||||
@Excel(name = "是否禁用", combo = {"是", "否"}, readConverterExp = "true=是,false=否")
|
@Excel(name = "是否禁用", combo = {"是", "否"}, readConverterExp = "true=是,false=否", prompt = "必填", headerColor = IndexedColors.RED)
|
||||||
@ApiModelProperty("是否禁用")
|
@ApiModelProperty("是否禁用")
|
||||||
private Boolean disabled;
|
private Boolean disabled;
|
||||||
|
|
||||||
|
@ -115,12 +115,12 @@ public class Price extends BaseEntity implements LogBizParam
|
||||||
@ApiModelProperty("禁用时间")
|
@ApiModelProperty("禁用时间")
|
||||||
private LocalDateTime disabledTime;
|
private LocalDateTime disabledTime;
|
||||||
|
|
||||||
@Excel(name = "生产数量倍数分子(个)")
|
@Excel(name = "生产数量倍数分子(个)", prompt = "必填", headerColor = IndexedColors.RED)
|
||||||
@ApiModelProperty("生产数量倍数分子(个)")
|
@ApiModelProperty("生产数量倍数分子(个)")
|
||||||
@Min(value = 0, message = "生产数量倍数分子不允许小于0")
|
@Min(value = 0, message = "生产数量倍数分子不允许小于0")
|
||||||
private BigDecimal quantityNumerator;
|
private BigDecimal quantityNumerator;
|
||||||
|
|
||||||
@Excel(name = "生产数量倍数分母(个)")
|
@Excel(name = "生产数量倍数分母(个)", prompt = "必填", headerColor = IndexedColors.RED)
|
||||||
@ApiModelProperty("生产数量倍数分母(个)")
|
@ApiModelProperty("生产数量倍数分母(个)")
|
||||||
@Min(value = 1, message = "生产数量倍数分母不允许小于1")
|
@Min(value = 1, message = "生产数量倍数分母不允许小于1")
|
||||||
private BigDecimal quantityDenominator;
|
private BigDecimal quantityDenominator;
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
package com.ruoyi.yh.price.domain;
|
package com.ruoyi.yh.price.domain;
|
||||||
|
|
||||||
import com.ruoyi.common.annotation.Excel;
|
import com.ruoyi.common.annotation.Excel;
|
||||||
import com.ruoyi.yh.logImportDetail.domain.interfaces.ImportContent;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
import org.apache.poi.ss.usermodel.IndexedColors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author wjh
|
* @author wjh
|
||||||
|
@ -14,7 +14,7 @@ import lombok.EqualsAndHashCode;
|
||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
public class PriceVO extends Price {
|
public class PriceVO extends Price {
|
||||||
|
|
||||||
@Excel(name = "部门名称", prompt = "必填")
|
@Excel(name = "部门名称", prompt = "必填", headerColor = IndexedColors.RED)
|
||||||
@ApiModelProperty("部门名称")
|
@ApiModelProperty("部门名称")
|
||||||
private String deptName;
|
private String deptName;
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
package com.ruoyi.yh.price.domain.dto;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author wjh
|
||||||
|
* 2024/12/19
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class PriceImportParams {
|
||||||
|
|
||||||
|
@ApiModelProperty("覆盖更新")
|
||||||
|
private Boolean updateSupport;
|
||||||
|
|
||||||
|
@ApiModelProperty("直接审核通过")
|
||||||
|
private Boolean verified;
|
||||||
|
|
||||||
|
}
|
|
@ -3,7 +3,6 @@ package com.ruoyi.yh.price.domain.enums;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
||||||
import java.nio.charset.Charset;
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
@ -76,4 +75,11 @@ public enum PriceStatus {
|
||||||
public static List<String> canCheckToReport() {
|
public static List<String> canCheckToReport() {
|
||||||
return asList(PASS);
|
return asList(PASS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 允许删除的状态
|
||||||
|
*/
|
||||||
|
public static List<String> canDel() {
|
||||||
|
return asList(WAIT_SUBMIT, REJECT);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,6 +35,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
bp.disabled_time,
|
bp.disabled_time,
|
||||||
bp.quantity_numerator,
|
bp.quantity_numerator,
|
||||||
bp.quantity_denominator,
|
bp.quantity_denominator,
|
||||||
|
bp.deleted,
|
||||||
sd.dept_name as dept_name
|
sd.dept_name as dept_name
|
||||||
from bst_price bp
|
from bst_price bp
|
||||||
left join sys_dept sd on sd.dept_id = bp.dept_id
|
left join sys_dept sd on sd.dept_id = bp.dept_id
|
||||||
|
@ -60,6 +61,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="query.updateId != null "> and bp.update_id = #{query.updateId}</if>
|
<if test="query.updateId != null "> and bp.update_id = #{query.updateId}</if>
|
||||||
<if test="query.updateBy != null and query.updateBy != ''"> and bp.update_by like concat('%', #{query.updateBy}, '%')</if>
|
<if test="query.updateBy != null and query.updateBy != ''"> and bp.update_by like concat('%', #{query.updateBy}, '%')</if>
|
||||||
<if test="query.disabled != null "> and bp.disabled = #{query.disabled}</if>
|
<if test="query.disabled != null "> and bp.disabled = #{query.disabled}</if>
|
||||||
|
<if test="query.deleted != null "> and bp.deleted = #{query.deleted}</if>
|
||||||
|
<if test="query.deleted == null "> and bp.deleted = false</if>
|
||||||
<if test="query.statusList != null and query.statusList.size() > 0">
|
<if test="query.statusList != null and query.statusList.size() > 0">
|
||||||
and bp.status in
|
and bp.status in
|
||||||
<foreach item="item" collection="query.statusList" open="(" separator="," close=")">
|
<foreach item="item" collection="query.statusList" open="(" separator="," close=")">
|
||||||
|
@ -123,6 +126,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="disabledTime != null">disabled_time,</if>
|
<if test="disabledTime != null">disabled_time,</if>
|
||||||
<if test="quantityNumerator != null">quantity_numerator,</if>
|
<if test="quantityNumerator != null">quantity_numerator,</if>
|
||||||
<if test="quantityDenominator != null">quantity_denominator,</if>
|
<if test="quantityDenominator != null">quantity_denominator,</if>
|
||||||
|
<if test="deleted != null">deleted,</if>
|
||||||
</trim>
|
</trim>
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
<if test="priceId != null">#{priceId},</if>
|
<if test="priceId != null">#{priceId},</if>
|
||||||
|
@ -151,6 +155,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="disabledTime != null">#{disabledTime},</if>
|
<if test="disabledTime != null">#{disabledTime},</if>
|
||||||
<if test="quantityNumerator != null">#{quantityNumerator},</if>
|
<if test="quantityNumerator != null">#{quantityNumerator},</if>
|
||||||
<if test="quantityDenominator != null">#{quantityDenominator},</if>
|
<if test="quantityDenominator != null">#{quantityDenominator},</if>
|
||||||
|
<if test="deleted != null">#{deleted},</if>
|
||||||
</trim>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
|
@ -198,6 +203,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="data.disabledTime != null">bp.disabled_time = #{data.disabledTime},</if>
|
<if test="data.disabledTime != null">bp.disabled_time = #{data.disabledTime},</if>
|
||||||
<if test="data.quantityNumerator != null">quantity_numerator = #{data.quantityNumerator},</if>
|
<if test="data.quantityNumerator != null">quantity_numerator = #{data.quantityNumerator},</if>
|
||||||
<if test="data.quantityDenominator != null">quantity_denominator = #{data.quantityDenominator},</if>
|
<if test="data.quantityDenominator != null">quantity_denominator = #{data.quantityDenominator},</if>
|
||||||
|
<if test="data.deleted != null">deleted = #{data.deleted},</if>
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<delete id="deletePriceByPriceId" parameterType="Long">
|
<delete id="deletePriceByPriceId" parameterType="Long">
|
||||||
|
|
|
@ -1,11 +1,13 @@
|
||||||
package com.ruoyi.yh.price.service;
|
package com.ruoyi.yh.price.service;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import com.ruoyi.yh.price.domain.Price;
|
import com.ruoyi.yh.price.domain.Price;
|
||||||
import com.ruoyi.yh.price.domain.PriceVO;
|
|
||||||
import com.ruoyi.yh.price.domain.PriceQuery;
|
import com.ruoyi.yh.price.domain.PriceQuery;
|
||||||
|
import com.ruoyi.yh.price.domain.PriceVO;
|
||||||
|
import com.ruoyi.yh.price.domain.dto.PriceImportParams;
|
||||||
import com.ruoyi.yh.price.domain.dto.PriceVerifyDTO;
|
import com.ruoyi.yh.price.domain.dto.PriceVerifyDTO;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 单价Service接口
|
* 单价Service接口
|
||||||
*
|
*
|
||||||
|
@ -102,11 +104,11 @@ public interface PriceService
|
||||||
/**
|
/**
|
||||||
* 导入单价列表
|
* 导入单价列表
|
||||||
*
|
*
|
||||||
* @param priceList 单价列表
|
* @param priceList 单价列表
|
||||||
* @param updateSupport 是否覆盖已存在数据
|
* @param params
|
||||||
* @param operaId 操作人ID
|
* @param operaId 操作人ID
|
||||||
*/
|
*/
|
||||||
int importPrice(List<PriceVO> priceList, boolean updateSupport, Long operaId);
|
int importPrice(List<PriceVO> priceList, PriceImportParams params, Long operaId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据ID列表查询
|
* 根据ID列表查询
|
||||||
|
@ -115,4 +117,8 @@ public interface PriceService
|
||||||
*/
|
*/
|
||||||
List<PriceVO> selectPriceListByIds(List<Long> priceIds);
|
List<PriceVO> selectPriceListByIds(List<Long> priceIds);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 逻辑删除
|
||||||
|
*/
|
||||||
|
int logicDel(Long id);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,5 @@
|
||||||
package com.ruoyi.yh.price.service.impl;
|
package com.ruoyi.yh.price.service.impl;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.concurrent.ScheduledExecutorService;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
|
|
||||||
import com.ruoyi.common.core.domain.entity.SysDept;
|
import com.ruoyi.common.core.domain.entity.SysDept;
|
||||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||||
import com.ruoyi.common.core.validate.ValidGroup;
|
import com.ruoyi.common.core.validate.ValidGroup;
|
||||||
|
@ -16,28 +8,36 @@ import com.ruoyi.common.utils.DateUtils;
|
||||||
import com.ruoyi.common.utils.ServiceUtil;
|
import com.ruoyi.common.utils.ServiceUtil;
|
||||||
import com.ruoyi.common.utils.bean.BeanValidators;
|
import com.ruoyi.common.utils.bean.BeanValidators;
|
||||||
import com.ruoyi.common.utils.collection.CollectionUtils;
|
import com.ruoyi.common.utils.collection.CollectionUtils;
|
||||||
import com.ruoyi.system.user.domain.SysUserVO;
|
|
||||||
import com.ruoyi.system.service.ISysDeptService;
|
import com.ruoyi.system.service.ISysDeptService;
|
||||||
import com.ruoyi.system.service.ISysUserService;
|
import com.ruoyi.system.service.ISysUserService;
|
||||||
|
import com.ruoyi.system.user.domain.SysUserVO;
|
||||||
import com.ruoyi.yh.logImport.domain.LogImportVO;
|
import com.ruoyi.yh.logImport.domain.LogImportVO;
|
||||||
import com.ruoyi.yh.logImport.domain.enums.LogImportBizType;
|
import com.ruoyi.yh.logImport.domain.enums.LogImportBizType;
|
||||||
import com.ruoyi.yh.logImport.domain.enums.LogImportType;
|
import com.ruoyi.yh.logImport.domain.enums.LogImportType;
|
||||||
import com.ruoyi.yh.logImport.service.LogImportService;
|
import com.ruoyi.yh.logImport.service.LogImportService;
|
||||||
import com.ruoyi.yh.logImportDetail.domain.enums.LogImportDetailType;
|
import com.ruoyi.yh.logImportDetail.domain.enums.LogImportDetailType;
|
||||||
import com.ruoyi.yh.logImportDetail.service.ILogImportDetailService;
|
import com.ruoyi.yh.logImportDetail.service.ILogImportDetailService;
|
||||||
|
import com.ruoyi.yh.price.domain.Price;
|
||||||
|
import com.ruoyi.yh.price.domain.PriceQuery;
|
||||||
|
import com.ruoyi.yh.price.domain.PriceVO;
|
||||||
|
import com.ruoyi.yh.price.domain.dto.PriceImportParams;
|
||||||
import com.ruoyi.yh.price.domain.dto.PriceVerifyDTO;
|
import com.ruoyi.yh.price.domain.dto.PriceVerifyDTO;
|
||||||
import com.ruoyi.yh.price.domain.enums.PriceStatus;
|
import com.ruoyi.yh.price.domain.enums.PriceStatus;
|
||||||
|
import com.ruoyi.yh.price.mapper.PriceMapper;
|
||||||
|
import com.ruoyi.yh.price.service.PriceService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.ruoyi.yh.price.mapper.PriceMapper;
|
|
||||||
import com.ruoyi.yh.price.domain.Price;
|
|
||||||
import com.ruoyi.yh.price.domain.PriceVO;
|
|
||||||
import com.ruoyi.yh.price.domain.PriceQuery;
|
|
||||||
import com.ruoyi.yh.price.service.PriceService;
|
|
||||||
import org.springframework.transaction.support.TransactionTemplate;
|
import org.springframework.transaction.support.TransactionTemplate;
|
||||||
|
|
||||||
import javax.validation.Validator;
|
import javax.validation.Validator;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.concurrent.ScheduledExecutorService;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 单价Service业务层处理
|
* 单价Service业务层处理
|
||||||
|
@ -298,10 +298,13 @@ public class PriceServiceImpl implements PriceService
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int importPrice(List<PriceVO> priceList, boolean updateSupport, Long operaId) {
|
public int importPrice(List<PriceVO> priceList, PriceImportParams params, Long operaId) {
|
||||||
if (CollectionUtils.isEmptyElement(priceList)) {
|
if (CollectionUtils.isEmptyElement(priceList)) {
|
||||||
throw new ServiceException("导入数据不允许为空");
|
throw new ServiceException("导入数据不允许为空");
|
||||||
}
|
}
|
||||||
|
boolean updateSupport = params.getUpdateSupport() != null && params.getUpdateSupport();
|
||||||
|
boolean verified = params.getVerified() != null && params.getVerified();
|
||||||
|
|
||||||
SysUser user = userService.selectUserById(operaId);
|
SysUser user = userService.selectUserById(operaId);
|
||||||
ServiceUtil.assertion(user == null, "操作人不存在");
|
ServiceUtil.assertion(user == null, "操作人不存在");
|
||||||
|
|
||||||
|
@ -311,7 +314,7 @@ public class PriceServiceImpl implements PriceService
|
||||||
|
|
||||||
// 开始异步导入
|
// 开始异步导入
|
||||||
scheduledExecutorService.schedule(() -> {
|
scheduledExecutorService.schedule(() -> {
|
||||||
// 查询关联表
|
// 转换数据
|
||||||
// 部门
|
// 部门
|
||||||
List<SysDept> deptList = deptService.selectDeptListByNames(CollectionUtils.map(priceList, PriceVO::getDeptName));
|
List<SysDept> deptList = deptService.selectDeptListByNames(CollectionUtils.map(priceList, PriceVO::getDeptName));
|
||||||
// 创建人
|
// 创建人
|
||||||
|
@ -339,6 +342,11 @@ public class PriceServiceImpl implements PriceService
|
||||||
price.setCreateId(userList.stream().filter(u -> u.getNickName().equals(price.getCreateBy())).findFirst().orElse(defaultUser).getUserId());
|
price.setCreateId(userList.stream().filter(u -> u.getNickName().equals(price.getCreateBy())).findFirst().orElse(defaultUser).getUserId());
|
||||||
price.setUpdateId(userList.stream().filter(u -> u.getNickName().equals(price.getUpdateBy())).findFirst().orElse(defaultUser).getUserId());
|
price.setUpdateId(userList.stream().filter(u -> u.getNickName().equals(price.getUpdateBy())).findFirst().orElse(defaultUser).getUserId());
|
||||||
price.setVerifyId(userList.stream().filter(u -> u.getNickName().equals(price.getVerifyBy())).findFirst().orElse(defaultUser).getUserId());
|
price.setVerifyId(userList.stream().filter(u -> u.getNickName().equals(price.getVerifyBy())).findFirst().orElse(defaultUser).getUserId());
|
||||||
|
if (verified) {
|
||||||
|
price.setStatus(PriceStatus.PASS.getStatus());
|
||||||
|
} else {
|
||||||
|
price.setStatus(PriceStatus.WAIT_VERIFY.getStatus());
|
||||||
|
}
|
||||||
|
|
||||||
// 操作数据库
|
// 操作数据库
|
||||||
transactionTemplate.execute(status -> {
|
transactionTemplate.execute(status -> {
|
||||||
|
@ -393,4 +401,22 @@ public class PriceServiceImpl implements PriceService
|
||||||
query.setPriceIds(priceIds);
|
query.setPriceIds(priceIds);
|
||||||
return priceMapper.selectPriceList(query);
|
return priceMapper.selectPriceList(query);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int logicDel(Long id) {
|
||||||
|
if (id == null) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
PriceVO old = this.selectPriceByPriceId(id);
|
||||||
|
ServiceUtil.assertion(old == null, "待删除的单价不存在");
|
||||||
|
ServiceUtil.assertion(!PriceStatus.canDel().contains(old.getStatus()), "当前单价状态不允许被删除");
|
||||||
|
|
||||||
|
Price data = new Price();
|
||||||
|
data.setDeleted(true);
|
||||||
|
PriceQuery query = new PriceQuery();
|
||||||
|
query.setPriceId(id);
|
||||||
|
query.setStatusList(PriceStatus.canDel());
|
||||||
|
query.setDeleted(false);
|
||||||
|
return this.updateByQuery(data, query);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,9 @@ package com.ruoyi.yh.reportProd.domain;
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -15,4 +17,7 @@ public class ReportProdQuery extends ReportProdVO {
|
||||||
@ApiModelProperty("报表ID列表")
|
@ApiModelProperty("报表ID列表")
|
||||||
private List<Long> reportIds;
|
private List<Long> reportIds;
|
||||||
|
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||||
|
@ApiModelProperty("报表日期范围")
|
||||||
|
private List<LocalDate> reportDateRange;
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,6 +31,9 @@ public class ReportProdVO extends ReportProd {
|
||||||
@ApiModelProperty("工序部门ID")
|
@ApiModelProperty("工序部门ID")
|
||||||
private Long priceDeptId;
|
private Long priceDeptId;
|
||||||
|
|
||||||
|
@ApiModelProperty("工序部门名称")
|
||||||
|
private String priceDeptName;
|
||||||
|
|
||||||
@ApiModelProperty("总价")
|
@ApiModelProperty("总价")
|
||||||
private BigDecimal totalAmount;
|
private BigDecimal totalAmount;
|
||||||
|
|
||||||
|
|
|
@ -31,10 +31,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
brp.remark,
|
brp.remark,
|
||||||
brp.price_price * brp.num as total_amount,
|
brp.price_price * brp.num as total_amount,
|
||||||
bp.dept_id as price_dept_id,
|
bp.dept_id as price_dept_id,
|
||||||
br.status as report_status
|
br.status as report_status,
|
||||||
|
sd.dept_name as price_dept_name
|
||||||
from bst_report_prod brp
|
from bst_report_prod brp
|
||||||
left join bst_report br on br.report_id = brp.report_id
|
left join bst_report br on br.report_id = brp.report_id
|
||||||
left join bst_price bp on bp.price_id = brp.price_id
|
left join bst_price bp on bp.price_id = brp.price_id
|
||||||
|
left join sys_dept sd on sd.dept_id = bp.dept_id
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<sql id="searchCondition">
|
<sql id="searchCondition">
|
||||||
|
@ -59,6 +61,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
#{item}
|
#{item}
|
||||||
</foreach>
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
|
<if test="query.reportDateRange != null and query.reportDateRange.size() > 1">
|
||||||
|
and date(br.report_date) >= #{query.reportDateRange[0]}
|
||||||
|
and date(br.report_date) <= #{query.reportDateRange[1]}
|
||||||
|
</if>
|
||||||
${query.params.dataScope}
|
${query.params.dataScope}
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
|
@ -368,6 +374,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
</otherwise>
|
</otherwise>
|
||||||
</choose>
|
</choose>
|
||||||
</foreach>
|
</foreach>
|
||||||
|
<foreach open="defect_num = CASE id" collection="list" item="item" close="END,">
|
||||||
|
<choose>
|
||||||
|
<when test="item.defectNum != null">
|
||||||
|
WHEN #{item.id} THEN #{item.defectNum}
|
||||||
|
</when>
|
||||||
|
<otherwise>
|
||||||
|
WHEN #{item.id} THEN `defect_num`
|
||||||
|
</otherwise>
|
||||||
|
</choose>
|
||||||
|
</foreach>
|
||||||
</trim>
|
</trim>
|
||||||
where id in
|
where id in
|
||||||
<foreach item="item" collection="list" open="(" separator="," close=")">
|
<foreach item="item" collection="list" open="(" separator="," close=")">
|
||||||
|
|
|
@ -11,9 +11,11 @@ import com.ruoyi.common.enums.BusinessType;
|
||||||
import com.ruoyi.common.enums.LogBizType;
|
import com.ruoyi.common.enums.LogBizType;
|
||||||
import com.ruoyi.common.utils.SecurityUtils;
|
import com.ruoyi.common.utils.SecurityUtils;
|
||||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
|
import com.ruoyi.framework.web.service.PermissionService;
|
||||||
import com.ruoyi.yh.price.domain.Price;
|
import com.ruoyi.yh.price.domain.Price;
|
||||||
import com.ruoyi.yh.price.domain.PriceQuery;
|
import com.ruoyi.yh.price.domain.PriceQuery;
|
||||||
import com.ruoyi.yh.price.domain.PriceVO;
|
import com.ruoyi.yh.price.domain.PriceVO;
|
||||||
|
import com.ruoyi.yh.price.domain.dto.PriceImportParams;
|
||||||
import com.ruoyi.yh.price.domain.dto.PriceVerifyDTO;
|
import com.ruoyi.yh.price.domain.dto.PriceVerifyDTO;
|
||||||
import com.ruoyi.yh.price.service.PriceConverter;
|
import com.ruoyi.yh.price.service.PriceConverter;
|
||||||
import com.ruoyi.yh.price.service.PriceService;
|
import com.ruoyi.yh.price.service.PriceService;
|
||||||
|
@ -46,6 +48,9 @@ public class PriceController extends BaseController
|
||||||
@Autowired
|
@Autowired
|
||||||
private ScheduledExecutorService scheduledExecutorService;
|
private ScheduledExecutorService scheduledExecutorService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private PermissionService permissionService;
|
||||||
|
|
||||||
@PreAuthorize("@ss.hasPermi('yh:price:list')")
|
@PreAuthorize("@ss.hasPermi('yh:price:list')")
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
@DataScope(deptAlias = "sd")
|
@DataScope(deptAlias = "sd")
|
||||||
|
@ -105,6 +110,14 @@ public class PriceController extends BaseController
|
||||||
return toAjax(priceService.updatePrice(po));
|
return toAjax(priceService.updatePrice(po));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@PreAuthorize("@ss.hasPermi('yh:price:delete')")
|
||||||
|
@Log(title = LogTitle.PRICE, businessType = BusinessType.DELETE, bizType = LogBizType.PRICE, bizIdName = "arg0")
|
||||||
|
@DeleteMapping("/{id}")
|
||||||
|
public AjaxResult delete(@PathVariable Long id) {
|
||||||
|
return toAjax(priceService.logicDel(id));
|
||||||
|
}
|
||||||
|
|
||||||
@PreAuthorize("@ss.hasPermi('yh:price:submit')")
|
@PreAuthorize("@ss.hasPermi('yh:price:submit')")
|
||||||
@Log(title = LogTitle.PRICE, businessType = BusinessType.SUBMIT, bizType = LogBizType.PRICE, bizIdName = "arg0")
|
@Log(title = LogTitle.PRICE, businessType = BusinessType.SUBMIT, bizType = LogBizType.PRICE, bizIdName = "arg0")
|
||||||
@PutMapping("/{priceId}/submit")
|
@PutMapping("/{priceId}/submit")
|
||||||
|
@ -151,10 +164,12 @@ public class PriceController extends BaseController
|
||||||
@Log(title = "单价导入", businessType = BusinessType.IMPORT, bizType = LogBizType.PRICE)
|
@Log(title = "单价导入", businessType = BusinessType.IMPORT, bizType = LogBizType.PRICE)
|
||||||
@PreAuthorize("@ss.hasPermi('yh:price:import')")
|
@PreAuthorize("@ss.hasPermi('yh:price:import')")
|
||||||
@PostMapping("/importData")
|
@PostMapping("/importData")
|
||||||
public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception
|
public AjaxResult importData(MultipartFile file, PriceImportParams params) throws Exception {
|
||||||
{
|
if (params.getVerified() != null && params.getVerified() && !permissionService.hasPermi("yh:price:verify")) {
|
||||||
|
return error("您无权直接审核通过");
|
||||||
|
}
|
||||||
ExcelUtil<PriceVO> util = new ExcelUtil<PriceVO>(PriceVO.class);
|
ExcelUtil<PriceVO> util = new ExcelUtil<PriceVO>(PriceVO.class);
|
||||||
List<PriceVO> priceList = util.importExcel(file.getInputStream());
|
List<PriceVO> priceList = util.importExcel(file.getInputStream());
|
||||||
return success(priceService.importPrice(priceList, updateSupport, getUserId()));
|
return success(priceService.importPrice(priceList, params, getUserId()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,7 +54,7 @@ spring:
|
||||||
profiles:
|
profiles:
|
||||||
active:
|
active:
|
||||||
- dev
|
- dev
|
||||||
- druid-prod
|
- druid
|
||||||
# 文件上传
|
# 文件上传
|
||||||
servlet:
|
servlet:
|
||||||
multipart:
|
multipart:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user