diff --git a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/system/user/mapper/SysUserMapper.xml b/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/system/user/mapper/SysUserMapper.xml
index 1946e3c..862b4cf 100644
--- a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/system/user/mapper/SysUserMapper.xml
+++ b/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/system/user/mapper/SysUserMapper.xml
@@ -95,6 +95,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
AND u.phonenumber = #{eqPhonenumber}
+
+ AND u.nick_name like concat('%', #{nickName}, '%')
+
AND date_format(u.create_time,'%Y%m%d') >= date_format(#{params.beginTime},'%Y%m%d')
diff --git a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/yh/material/utils/MaterialUtil.java b/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/yh/material/utils/MaterialUtil.java
index 77f2059..2d1fcfe 100644
--- a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/yh/material/utils/MaterialUtil.java
+++ b/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/yh/material/utils/MaterialUtil.java
@@ -5,6 +5,8 @@ import com.ruoyi.yh.material.domain.vo.MaterialNumberSplitVO;
import lombok.extern.slf4j.Slf4j;
import java.util.Arrays;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
/**
* 物料工具类
@@ -66,4 +68,12 @@ public class MaterialUtil {
return vo;
}
+ public static String parseToCode(String category, String size, String surface, String graphics) {
+ // 除了盖子,其余都用点连接,如果为空或者空字符串,则忽略
+ String code = Stream.of(category, size, surface, graphics)
+ .filter(StringUtils::isNotBlank)
+ .collect(Collectors.joining("."));
+
+ return code;
+ }
}
diff --git a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/yh/price/domain/Price.java b/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/yh/price/domain/Price.java
index b5ecd16..f5736ba 100644
--- a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/yh/price/domain/Price.java
+++ b/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/yh/price/domain/Price.java
@@ -146,6 +146,12 @@ public class Price extends BaseEntity implements LogBizParam
@Excel(name = "备注")
private String remark;
+ @Excel(name = "代码")
+ private String code;
+
+ @Excel(name = "表面处理")
+ private String surface;
+
/**
* 获取日志业务ID
*/
diff --git a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/yh/price/domain/dto/PriceVerifyDTO.java b/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/yh/price/domain/dto/PriceVerifyDTO.java
index e8d0949..1b789c5 100644
--- a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/yh/price/domain/dto/PriceVerifyDTO.java
+++ b/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/yh/price/domain/dto/PriceVerifyDTO.java
@@ -6,6 +6,8 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull;
+import javax.validation.constraints.Size;
+import java.util.List;
/**
* 单价审核DTO
@@ -17,7 +19,8 @@ public class PriceVerifyDTO implements LogBizParam {
@ApiModelProperty("单价ID")
@NotNull(message = "单价ID不允许为空")
- private Long priceId;
+ @Size(min = 1, message = "单价ID不允许为空")
+ private List priceIds;
@ApiModelProperty("是否通过")
@NotNull(message = "是否通过不允许为空")
@@ -31,6 +34,6 @@ public class PriceVerifyDTO implements LogBizParam {
*/
@Override
public Object logBizId() {
- return this.getPriceId();
+ return this.getPriceIds();
}
}
diff --git a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/yh/price/mapper/PriceMapper.xml b/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/yh/price/mapper/PriceMapper.xml
index 85ed94a..1c32190 100644
--- a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/yh/price/mapper/PriceMapper.xml
+++ b/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/yh/price/mapper/PriceMapper.xml
@@ -36,6 +36,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
bp.quantity_numerator,
bp.quantity_denominator,
bp.deleted,
+ bp.code,
+ bp.surface,
sd.dept_name as dept_name
from bst_price bp
left join sys_dept sd on sd.dept_id = bp.dept_id
@@ -63,6 +65,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and bp.disabled = #{query.disabled}
and bp.deleted = #{query.deleted}
and bp.deleted = false
+ and bp.code like concat('%', #{query.code}, '%')
+ and bp.surface like concat('%', #{query.surface}, '%')
and bp.status in
@@ -127,6 +131,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
quantity_numerator,
quantity_denominator,
deleted,
+ `code`,
+ `surface`,
#{priceId},
@@ -156,6 +162,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{quantityNumerator},
#{quantityDenominator},
#{deleted},
+ #{code},
+ #{surface},
@@ -204,6 +212,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
quantity_numerator = #{data.quantityNumerator},
quantity_denominator = #{data.quantityDenominator},
deleted = #{data.deleted},
+ `code` = #{data.code},
+ `surface` = #{data.surface},
diff --git a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/yh/price/service/impl/PriceConverterImpl.java b/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/yh/price/service/impl/PriceConverterImpl.java
index 3e9a80a..1ce0945 100644
--- a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/yh/price/service/impl/PriceConverterImpl.java
+++ b/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/yh/price/service/impl/PriceConverterImpl.java
@@ -1,8 +1,8 @@
package com.ruoyi.yh.price.service.impl;
import com.ruoyi.common.core.domain.model.LoginUser;
-import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
+import com.ruoyi.yh.material.utils.MaterialUtil;
import com.ruoyi.yh.price.domain.Price;
import com.ruoyi.yh.price.domain.enums.PriceStatus;
import com.ruoyi.yh.price.service.PriceConverter;
@@ -43,6 +43,8 @@ public class PriceConverterImpl implements PriceConverter {
po.setQuantityNumerator(data.getQuantityNumerator());
po.setCreateBy(loginUser.getUsername());
po.setRemark(data.getRemark());
+ po.setSurface(data.getSurface());
+ po.setCode(MaterialUtil.parseToCode(po.getCategory(), po.getSize(), po.getSurface(), po.getPattern()));
return po;
}
@@ -71,6 +73,7 @@ public class PriceConverterImpl implements PriceConverter {
po.setUpdateId(loginUser.getUserId());
po.setUpdateBy(loginUser.getUsername());
po.setRemark(data.getRemark());
+ po.setCode(MaterialUtil.parseToCode(po.getCategory(), po.getSize(), po.getSurface(), po.getPattern()));
return po;
}
}
diff --git a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/yh/price/service/impl/PriceServiceImpl.java b/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/yh/price/service/impl/PriceServiceImpl.java
index 7eb4db8..1679bd8 100644
--- a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/yh/price/service/impl/PriceServiceImpl.java
+++ b/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/yh/price/service/impl/PriceServiceImpl.java
@@ -17,6 +17,7 @@ import com.ruoyi.yh.logImport.domain.enums.LogImportType;
import com.ruoyi.yh.logImport.service.LogImportService;
import com.ruoyi.yh.logImportDetail.domain.enums.LogImportDetailType;
import com.ruoyi.yh.logImportDetail.service.ILogImportDetailService;
+import com.ruoyi.yh.material.utils.MaterialUtil;
import com.ruoyi.yh.price.domain.Price;
import com.ruoyi.yh.price.domain.PriceQuery;
import com.ruoyi.yh.price.domain.PriceVO;
@@ -214,33 +215,42 @@ public class PriceServiceImpl implements PriceService
@Override
public int verify(PriceVerifyDTO dto) {
- if (dto == null || dto.getPriceId() == null || dto.getPass() == null) {
+ if (dto == null || CollectionUtils.isEmptyElement(dto.getPriceIds()) || dto.getPass() == null) {
return 0;
}
- PriceVO old = selectPriceByPriceId(dto.getPriceId());
- ServiceUtil.assertion(old == null, "待审核的单价不存在,请刷新后重试");
- ServiceUtil.assertion(!PriceStatus.canVerify().contains(old.getStatus()), "待审核的单价当前状态无法审核,请刷新后重试");
- Integer result = transactionTemplate.execute(status -> {
- // 修改状态
- Price data = new Price();
- data.setStatus(dto.getPass() ? PriceStatus.PASS.getStatus() : PriceStatus.REJECT.getStatus());
- data.setVerifyTime(LocalDateTime.now());
- SysUser verifyUser = dto.getVerifyUser();
- if (verifyUser != null) {
- data.setVerifyBy(verifyUser.getNickName());
- data.setVerifyId(verifyUser.getUserId());
- }
- PriceQuery query = new PriceQuery();
- query.setPriceId(dto.getPriceId());
- query.setStatusList(PriceStatus.canVerify());
- int update = this.updateByQuery(data, query);
- ServiceUtil.assertion(update != 1, "审核失败,当前单价状态已发生变化,请刷新后重试");
+ List oldList = selectPriceListByIds(dto.getPriceIds());
- return update;
- });
+ int verified = 0;
- return result == null ? 0 : result;
+ for (Long priceId : dto.getPriceIds()) {
+ PriceVO old = oldList.stream().filter(item -> item.getPriceId().equals(priceId)).findFirst().orElse(null);
+ ServiceUtil.assertion(old == null, "待审核ID为%s的单价不存在,请刷新后重试", priceId);
+ ServiceUtil.assertion(!PriceStatus.canVerify().contains(old.getStatus()), "待审核ID为%s的单价当前状态无法审核,请刷新后重试", priceId);
+
+ Integer result = transactionTemplate.execute(status -> {
+ // 修改状态
+ Price data = new Price();
+ data.setStatus(dto.getPass() ? PriceStatus.PASS.getStatus() : PriceStatus.REJECT.getStatus());
+ data.setVerifyTime(LocalDateTime.now());
+ SysUser verifyUser = dto.getVerifyUser();
+ if (verifyUser != null) {
+ data.setVerifyBy(verifyUser.getNickName());
+ data.setVerifyId(verifyUser.getUserId());
+ }
+ PriceQuery query = new PriceQuery();
+ query.setPriceId(priceId);
+ query.setStatusList(PriceStatus.canVerify());
+ int update = this.updateByQuery(data, query);
+ ServiceUtil.assertion(update != 1, "审核失败,待审核ID为%s的单价状态已发生变化,请刷新后重试", priceId);
+
+ return update;
+ });
+
+ verified += (result == null ? 0 : result);
+ }
+
+ return verified;
}
@Override
@@ -347,6 +357,7 @@ public class PriceServiceImpl implements PriceService
} else {
price.setStatus(PriceStatus.WAIT_VERIFY.getStatus());
}
+ price.setCode(MaterialUtil.parseToCode(price.getCategory(), price.getSize(), price.getSurface(), price.getPattern()));
// 操作数据库
transactionTemplate.execute(status -> {
diff --git a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/yh/reportProd/domain/ReportProd.java b/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/yh/reportProd/domain/ReportProd.java
index 33f29d5..2348f65 100644
--- a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/yh/reportProd/domain/ReportProd.java
+++ b/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/yh/reportProd/domain/ReportProd.java
@@ -97,4 +97,9 @@ public class ReportProd extends BaseEntity
@Size(max = 200, message = "备注长度不允许超过200个字符")
private String remark;
+
+ @Excel(name = "总价(元)")
+ @ApiModelProperty("总价")
+ private BigDecimal totalAmount;
+
}
diff --git a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/yh/reportProd/domain/ReportProdVO.java b/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/yh/reportProd/domain/ReportProdVO.java
index fe5de2a..3f76fb3 100644
--- a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/yh/reportProd/domain/ReportProdVO.java
+++ b/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/yh/reportProd/domain/ReportProdVO.java
@@ -9,7 +9,6 @@ import lombok.Data;
import javax.validation.Valid;
import javax.validation.constraints.Size;
-import java.math.BigDecimal;
import java.util.List;
/**
@@ -34,10 +33,8 @@ public class ReportProdVO extends ReportProd {
@ApiModelProperty("工序部门名称")
private String priceDeptName;
- @ApiModelProperty("总价")
- private BigDecimal totalAmount;
-
@ApiModelProperty("报表状态")
@Excel(name = "报表状态", dictType = DictType.REPORT_STATUS)
private String reportStatus;
+
}
diff --git a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/yh/reportProd/mapper/ReportProdMapper.xml b/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/yh/reportProd/mapper/ReportProdMapper.xml
index a9403bc..df8005a 100644
--- a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/yh/reportProd/mapper/ReportProdMapper.xml
+++ b/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/yh/reportProd/mapper/ReportProdMapper.xml
@@ -29,7 +29,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
brp.deleted,
brp.price_type,
brp.remark,
- brp.price_price * brp.num as total_amount,
+ brp.total_amount,
bp.dept_id as price_dept_id,
br.status as report_status,
sd.dept_name as price_dept_name
@@ -100,6 +100,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
price_quantity_denominator,
price_type,
remark,
+ total_amount,
#{reportId},
@@ -119,6 +120,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{priceQuantityDenominator},
#{priceType},
#{remark},
+ #{totalAmount},
@@ -140,7 +142,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
price_quantity_numerator,
price_quantity_denominator,
price_type,
- remark
+ remark,
+ total_amount
)
values
@@ -179,6 +182,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
default,
#{i.remark},
default,
+ #{i.totalAmount},
+ default,
@@ -209,6 +214,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
price_quantity_denominator = #{data.priceQuantityDenominator},
price_type = #{data.priceType},
remark = #{data.remark},
+ total_amount = #{data.totalAmount},
@@ -384,6 +390,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+
+
+
+ WHEN #{item.id} THEN #{item.totalAmount}
+
+
+ WHEN #{item.id} THEN `total_amount`
+
+
+
where id in
diff --git a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/yh/reportProd/service/impl/ReportProdConverterImpl.java b/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/yh/reportProd/service/impl/ReportProdConverterImpl.java
index 93f1e36..80625a7 100644
--- a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/yh/reportProd/service/impl/ReportProdConverterImpl.java
+++ b/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/yh/reportProd/service/impl/ReportProdConverterImpl.java
@@ -52,6 +52,7 @@ public class ReportProdConverterImpl implements ReportProdConverter {
bo.setPriceType(vo.getPriceType());
bo.setRemark(vo.getRemark());
bo.setDefectNum(vo.getDefectNum());
+ bo.setTotalAmount(vo.getPricePrice().multiply(vo.getNum().add(vo.getDefectNum())));
// 用户产量明细
List userProdList = new ArrayList<>();
@@ -101,6 +102,7 @@ public class ReportProdConverterImpl implements ReportProdConverter {
bo.setPriceType(vo.getPriceType());
bo.setRemark(vo.getRemark());
bo.setDefectNum(vo.getDefectNum());
+ bo.setTotalAmount(vo.getPricePrice().multiply(vo.getNum().add(vo.getDefectNum())));
// 用户产量明细
List userProdList = new ArrayList<>();
diff --git a/ruoyi-web/src/main/java/com/ruoyi/web/yh/PriceController.java b/ruoyi-web/src/main/java/com/ruoyi/web/yh/PriceController.java
index c43171a..ff3490c 100644
--- a/ruoyi-web/src/main/java/com/ruoyi/web/yh/PriceController.java
+++ b/ruoyi-web/src/main/java/com/ruoyi/web/yh/PriceController.java
@@ -135,7 +135,7 @@ public class PriceController extends BaseController
@PreAuthorize("@ss.hasPermi('yh:price:verify')")
@Log(title = LogTitle.PRICE, businessType = BusinessType.VERIFY, bizType = LogBizType.PRICE, bizIdName = "arg0")
@PutMapping("/verify")
- public AjaxResult submit(@RequestBody @Validated PriceVerifyDTO dto) {
+ public AjaxResult verify(@RequestBody @Validated PriceVerifyDTO dto) {
dto.setVerifyUser(SecurityUtils.getLoginUser().getUser());
return toAjax(priceService.verify(dto));
}