优化体验

This commit is contained in:
磷叶 2024-12-31 17:00:20 +08:00
parent 75fe422b6d
commit 1cc282975f
12 changed files with 98 additions and 32 deletions

View File

@ -95,6 +95,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="eqPhonenumber != null and eqPhonenumber != ''">
AND u.phonenumber = #{eqPhonenumber}
</if>
<if test="nickName != null and nickName != ''">
AND u.nick_name like concat('%', #{nickName}, '%')
</if>
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
AND date_format(u.create_time,'%Y%m%d') &gt;= date_format(#{params.beginTime},'%Y%m%d')
</if>

View File

@ -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;
}
}

View File

@ -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
*/

View File

@ -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<Long> priceIds;
@ApiModelProperty("是否通过")
@NotNull(message = "是否通过不允许为空")
@ -31,6 +34,6 @@ public class PriceVerifyDTO implements LogBizParam {
*/
@Override
public Object logBizId() {
return this.getPriceId();
return this.getPriceIds();
}
}

View File

@ -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"
<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.code != null and query.code!= ''"> and bp.code like concat('%', #{query.code}, '%')</if>
<if test="query.surface != null and query.surface!= ''"> and bp.surface like concat('%', #{query.surface}, '%')</if>
<if test="query.statusList != null and query.statusList.size() > 0">
and bp.status in
<foreach item="item" collection="query.statusList" open="(" separator="," close=")">
@ -127,6 +131,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="quantityNumerator != null">quantity_numerator,</if>
<if test="quantityDenominator != null">quantity_denominator,</if>
<if test="deleted != null">deleted,</if>
<if test="code!= null">`code`,</if>
<if test="surface!= null">`surface`,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="priceId != null">#{priceId},</if>
@ -156,6 +162,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="quantityNumerator != null">#{quantityNumerator},</if>
<if test="quantityDenominator != null">#{quantityDenominator},</if>
<if test="deleted != null">#{deleted},</if>
<if test="code!= null">#{code},</if>
<if test="surface!= null">#{surface},</if>
</trim>
</insert>
@ -204,6 +212,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="data.quantityNumerator != null">quantity_numerator = #{data.quantityNumerator},</if>
<if test="data.quantityDenominator != null">quantity_denominator = #{data.quantityDenominator},</if>
<if test="data.deleted != null">deleted = #{data.deleted},</if>
<if test="data.code!= null">`code` = #{data.code},</if>
<if test="data.surface!= null">`surface` = #{data.surface},</if>
</sql>
<delete id="deletePriceByPriceId" parameterType="Long">

View File

@ -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;
}
}

View File

@ -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<PriceVO> 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 -> {

View File

@ -97,4 +97,9 @@ public class ReportProd extends BaseEntity
@Size(max = 200, message = "备注长度不允许超过200个字符")
private String remark;
@Excel(name = "总价(元)")
@ApiModelProperty("总价")
private BigDecimal totalAmount;
}

View File

@ -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;
}

View File

@ -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"
<if test="priceQuantityDenominator != null">price_quantity_denominator,</if>
<if test="priceType != null and priceType != ''">price_type,</if>
<if test="remark != null and remark != ''">remark,</if>
<if test="totalAmount != null">total_amount,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="reportId != null">#{reportId},</if>
@ -119,6 +120,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="priceQuantityDenominator != null">#{priceQuantityDenominator},</if>
<if test="priceType != null and priceType != ''">#{priceType},</if>
<if test="remark != null and remark != ''">#{remark},</if>
<if test="totalAmount != null">#{totalAmount},</if>
</trim>
</insert>
@ -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
<foreach collection="list" item="i" separator=",">
@ -179,6 +182,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="i.priceType == null">default,</if>
<if test="i.remark != null">#{i.remark},</if>
<if test="i.remark == null">default,</if>
<if test="i.totalAmount != null">#{i.totalAmount},</if>
<if test="i.totalAmount == null">default,</if>
</trim>
</foreach>
</insert>
@ -209,6 +214,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="data.priceQuantityDenominator != null">price_quantity_denominator = #{data.priceQuantityDenominator},</if>
<if test="data.priceType != null and data.priceType != ''">price_type = #{data.priceType},</if>
<if test="data.remark != null and data.remark != ''">remark = #{data.remark},</if>
<if test="data.totalAmount != null">total_amount = #{data.totalAmount},</if>
</sql>
<update id="batchUpdate">
@ -384,6 +390,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</otherwise>
</choose>
</foreach>
<foreach open="total_amount = CASE id" collection="list" item="item" close="END,">
<choose>
<when test="item.totalAmount != null">
WHEN #{item.id} THEN #{item.totalAmount}
</when>
<otherwise>
WHEN #{item.id} THEN `total_amount`
</otherwise>
</choose>
</foreach>
</trim>
where id in
<foreach item="item" collection="list" open="(" separator="," close=")">

View File

@ -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<ReportUserProdBO> 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<ReportUserProdBO> userProdList = new ArrayList<>();

View File

@ -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));
}