xiaoyong931011
2021-06-30 cd4f41c98dd9a071b3e2003e324b9fd61472c7f4
Merge branch 'score-shop' of http://120.27.238.55:7000/r/xzx into score-shop
3 files modified
15 ■■■■ changed files
gc-core/src/main/java/com/xzx/gc/entity/JhyOrderItems.java 6 ●●●●● patch | view | raw | blame | history
gc-order/src/main/java/com/xzx/gc/order/service/JhyOrderService.java 5 ●●●●● patch | view | raw | blame | history
gc-order/src/main/resources/mapper/order/JhyOrderItemsMapper.xml 4 ●●● patch | view | raw | blame | history
gc-core/src/main/java/com/xzx/gc/entity/JhyOrderItems.java
@@ -5,7 +5,9 @@
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.persistence.Column;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.math.BigDecimal;
@Data
@@ -35,4 +37,8 @@
    @ApiModelProperty(value="类型")
    private Long itemType;
    @Transient
    @ApiModelProperty(value = "单位")
    private transient String itemUnit;
}
gc-order/src/main/java/com/xzx/gc/order/service/JhyOrderService.java
@@ -168,9 +168,10 @@
        BigDecimal totalScore = BigDecimal.ZERO;
        for (JhyOrderConfirmItemsDto item : confirmDto.getItems()) {
            JhyOrderItems orderItem = jhyOrderItemsMapper.selectByPrimaryKey(item.getId());
            BigDecimal total = orderItem.getPrice().multiply(BigDecimal.valueOf(40)).multiply(new BigDecimal(item.getWeight()));
            BigDecimal weight = StrUtil.isNotBlank(item.getWeight()) ? new BigDecimal(item.getWeight()) : BigDecimal.ZERO;
            BigDecimal total = orderItem.getPrice().multiply(BigDecimal.valueOf(40)).multiply(weight);
            orderItem.setScore(total.setScale(0, BigDecimal.ROUND_DOWN).toString());
            orderItem.setWeight(new BigDecimal(item.getWeight()));
            orderItem.setWeight(weight);
            jhyOrderItemsMapper.updateByPrimaryKey(orderItem);
            totalScore = totalScore.add(total);
gc-order/src/main/resources/mapper/order/JhyOrderItemsMapper.xml
@@ -3,6 +3,8 @@
<mapper namespace="com.xzx.gc.order.mapper.JhyOrderItemsMapper">
    <select id="selectOrderItems" resultType="com.xzx.gc.entity.JhyOrderItems">
        select * from xzx_jhy_order_items where order_id=#{orderId}
        select a.*, b.item_unit itemUnit from xzx_jhy_order_items a
        left join xzx_sys_environmental_info b on a.item_type=b.id
        where a.order_id=#{orderId}
    </select>
</mapper>