改为orders

This commit is contained in:
lym
2024-06-17 16:07:29 +08:00
parent 283d46e492
commit 387de1e86a
19 changed files with 108 additions and 51 deletions
@@ -24,21 +24,17 @@ import io.swagger.v3.oas.annotations.Operation;
import javax.validation.*;
import javax.servlet.http.*;
import java.io.*;
import java.net.URLEncoder;
import java.util.*;
import com.cf.imes.framework.common.pojo.PageResult;
import com.cf.imes.framework.common.pojo.CommonResult;
import com.cf.imes.framework.common.util.object.BeanUtils;
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
import static com.cf.imes.framework.common.pojo.CommonResult.success;
import com.cf.imes.framework.operatelog.core.annotations.OperateLog;
import static com.cf.imes.framework.operatelog.core.enums.OperateTypeEnum.*;
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.*;
import com.cf.imes.module.executor.dal.dataobject.order.OrderDO;
import com.cf.imes.module.executor.service.order.OrderService;
@@ -47,14 +43,10 @@ import com.cf.imes.module.executor.service.order.OrderService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
@Tag(name = "管理后台 - 生产单管理")
@@ -117,7 +109,7 @@ public class OrderController {
@Operation(summary = "还原")
@Parameter(name = "orderId", description = "生产单id", required = true, example = "1")
@PreAuthorize("@ss.hasPermission('executor:order:restore')")
public CommonResult<Boolean> restoreOrder(@RequestParam("orderId") Long orderId) {
public CommonResult<Boolean> restoreOrder(@Valid @RequestBody Long orderId) {
orderService.restoreOrder(orderId);
return success(true);
}
@@ -254,6 +246,7 @@ public class OrderController {
// 读取文件
excelReadUtil.setErr(0);
Map<String, Object> map = excelReadUtil.read(file);
System.out.println(" map " + map);
System.err.println(excelReadUtil.isErr());
// 判断是否读取有误
if (excelReadUtil.isErr() == -1) { // 文件为空
@@ -261,6 +254,7 @@ public class OrderController {
return;
}else if (excelReadUtil.isErr() > 0) {
// 返回文件
System.out.println("(Map<Object, Object>) " + (Map<Object, Object>) map.get("order")+ " , (List<OrderPlateImportExcelVO>)" +(List<OrderPlateImportExcelVO>) map.get("plate"));
ExcelWriterUtil.write(response, (Map<Object, Object>) map.get("order"), (List<OrderPlateImportExcelVO>) map.get("plate"),orderService.getSavePath()+ "\\"+ "生产单Excel导入错误导出模板.xlsx");
return;
} else {
@@ -34,6 +34,9 @@ public class PlateGoodsRespVO {
@Schema(description = "板id", example = "11087")
private Long id;
@Schema(description = "板数量", example = "11087")
private Integer count = 1;
@Schema(description = "生产单号", example = "11087")
private Long orderId;
@@ -151,6 +154,12 @@ public class PlateGoodsRespVO {
@Schema(description = "是否孤形对角")
private Boolean isArcAcross;
@Schema(description = "是否异性")
private Boolean isSpecialShaped;
@Schema(description = "是否造型")
private Boolean isSculpt;
@Schema(description = "模块类型 ID", example = "12800")
private Long moduleTypeId;
@@ -14,7 +14,7 @@ import com.cf.imes.framework.mybatis.core.dataobject.BaseDO;
*
* @author 晨丰科技
*/
@TableName("`order`")
@TableName("`orders`")
@KeySequence("order_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
@Data
@EqualsAndHashCode(callSuper = true)
@@ -36,11 +36,11 @@ public interface OrderMapper extends BaseMapperX<OrderDO> {
.eqIfPresent(OrderDO::getOrderSort, reqVO.getOrderSort())
.eqIfPresent(OrderDO::getDataType, reqVO.getDataType())
.eqIfPresent(OrderDO::getStatus, reqVO.getStatus())
.eqIfPresent(OrderDO::getCustomOrderNo, reqVO.getCustomOrderNo())
.likeIfPresent(OrderDO::getCustomOrderNo, reqVO.getCustomOrderNo())
.eqIfPresent(OrderDO::getCustomer, reqVO.getCustomer())
.eqIfPresent(OrderDO::getAddress, reqVO.getAddress())
.likeIfPresent(OrderDO::getAddress, reqVO.getAddress())
.eqIfPresent(OrderDO::getPhoneNumber, reqVO.getPhoneNumber())
.eqIfPresent(OrderDO::getDealer, reqVO.getDealer())
.likeIfPresent(OrderDO::getDealer, reqVO.getDealer())
.eqIfPresent(OrderDO::getDealerPhoneNumber, reqVO.getDealerPhoneNumber())
.eqIfPresent(OrderDO::getSalesman, reqVO.getSalesman())
.eqIfPresent(OrderDO::getSplitter, reqVO.getSplitter())
@@ -67,9 +67,9 @@ public interface OrderPartsMapper extends BaseMapperX<OrderPartsDO> {
IPage<OrderPartsRespVO> selectProductList(@Param("page") IPage<OrderPartsRespVO> page , @Param("orderId")Long orderId, @Param("roomId")Long roomId , @Param("bodyId")Long bodyId,@Param("organId")Long organId);
List<PartGoodsRespVO> selectPartDetail(@Param("orderId") Long orderId, @Param("organId") Long organId);// 配件明细
List<PartGoodsRespVO> selectPartDetail(@Param("orderId") Long orderId, @Param("organId") Long organId, @Param("deleted") Integer deleted);// 配件明细
List<PartGoodsRespVO> selectPartAll(@Param("orderId") Long orderId, @Param("organId") Long organId);// 配件汇总
List<PartGoodsRespVO> selectPartAll(@Param("orderId") Long orderId, @Param("organId") Long organId, @Param("deleted") Integer deleted);// 配件汇总
// 单个修改删除状态
@@ -89,9 +89,9 @@ public interface PlateMapper extends BaseMapperX<PlateDO> {
List<PlateDetialRespVO> selectPlateDetialListByIds(@Param("orderIds") List<Long> orderIds,@Param("organId") Long organId);
List<PlateGoodsRespVO> selectPlateGoodsList(@Param("orderId") Long orderId, @Param("organId") Long organId); // 明细
List<PlateGoodsRespVO> selectPlateGoodsList(@Param("orderId") Long orderId, @Param("organId") Long organId, @Param("deleted") Integer deleted); // 明细
List<PlateGoodsRespVO> selectPlateGoodsListSummary(@Param("orderId") Long orderId, @Param("organId") Long organId); // 汇总
List<PlateGoodsRespVO> selectPlateGoodsListSummary(@Param("orderId") Long orderId, @Param("organId") Long organId, @Param("deleted") Integer deleted); // 汇总
// 单个修改删除状态
@@ -106,4 +106,6 @@ public interface PlateMapper extends BaseMapperX<PlateDO> {
}
void updateDeletedById(@Param("bodyId") Long bodyId, @Param("deleted") Integer deleted, @Param("organId") Long organId);
int countPlateByOrderId(@Param("orderId") Long orderId, @Param("organId") Long organId, @Param("deleted") Integer deleted);
}
@@ -56,7 +56,7 @@ public interface OrderService {
*
* @param orderId 编号组
*/
void restoreOrder(Long orderId);
void restoreOrder(@Valid Long orderId);
/**
* 获得生产单表 order_{N}
@@ -1,5 +1,6 @@
package com.cf.imes.module.executor.util.fileConversion.admin.api.webcad;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.incrementer.IdentifierGenerator;
@@ -400,7 +401,7 @@ public class ApiTypeRealize {
.unit(parts.getString("Units"))
.price(parts.getDouble("Price"))
.isComposite(parts.getBoolean("IsComposite"))
.remark(parts.getString("SpecExtras"))
.remark(partsRemarkChange(parts))
.build();
partsInfos.put(parts.getInteger("DataID"), partsInfo);
@@ -426,6 +427,22 @@ public class ApiTypeRealize {
return map;
}
// 配件备注集合
private String partsRemarkChange(JSONObject value) {
List<Map<String, String>> mapList = new ArrayList<>();
if (value != null && !value.isEmpty()) {
Map<String, String> map = new HashMap<>();
map.put("Remark", value.getString("Remark"));
map.put("SpecExtras", value.getString("SpecExtras"));
map.put("SpecialRemark", value.getString("SpecialRemark"));
map.put("DoorRemark", value.getString("DoorRemark"));
map.put("HingeRemark", value.getString("HingeRemark"));
mapList.add(map);
}
// 转String
String remark = JSON.toJSONString(mapList);
return remark;
}
/**
* 板材信息转换 写表 Integer指板材的ItemID板id 加一个板材自定义编号
*/
@@ -70,6 +70,8 @@ public class ExcelReadUtil { // 文件读取
map.put("order", orderMap);
if (orderMap.size() == 0)
isErr = -1;
if (list.size() == 0)
isErr = -1;
map.put("plate", list);
return map;
@@ -5,7 +5,7 @@
<select id="selectOrderPage" resultType="com.cf.imes.module.executor.controller.admin.plan.vo.OrderRespVOCopy">
select a.id as orderId, a.order_date, a.delivery_date, a.customer, a.address, a.custom_order_no as defineId,
count(op.id) as num, sum(op.area) as area
from `order` a
from `orders` a
left join order_item oi on a.id = oi.order_id and a.organ_id = oi.organ_id
inner join order_plate op on oi.plate_id = op.id and oi.organ_id = op.organ_id
inner join order_goods og on op.goods_id = og.id and op.organ_id = og.organ_id
@@ -16,14 +16,31 @@
<select id="selectPartDetail"
resultType="com.cf.imes.module.executor.controller.admin.orderParts.vo.PartGoodsRespVO">
SELECT a.id, a.goods_id, a.name, a.material, a.type, a.model, a.spec, a.brand, a.factory,
a.unit, a.price, a.is_composite, a.remark, b.num, c.name as body_name, c.id as body_id,
c.room_id, c.room_name, b.num * a.price AS total_price -- 添加计算总金额的列
SELECT a.id,
a.goods_id,
a.name,
a.material,
a.type,
a.model,
a.spec,
a.brand,
a.factory,
a.unit,
a.price,
a.is_composite,
a.remark,
b.num,
c.name as body_name,
c.id as body_id,
c.room_id,
c.room_name,
b.num * a.price AS total_price -- 添加计算总金额的列
FROM order_parts a
LEFT JOIN order_item b ON a.id = b.parts_id
LEFT JOIN order_body c on c.id = b.body_id
WHERE b.order_id = #{orderId}
and b.organ_id = #{organId}
and a.deleted = #{deleted}
</select>
<select id="selectPartAll"
@@ -44,7 +61,7 @@
WHERE
b.order_id = #{orderId}
AND b.organ_id = #{organId}
AND a.deleted = #{deleted}
</select>
<update id="updateDeletedById">
@@ -102,7 +102,7 @@
left JOIN order_plan_item opi on op.id = opi.plan_id
left join order_item oi on opi.item_id = oi.id
left join order_plate opl on oi.plate_id = opl.id
left join `order` o on oi.order_id = o.id
left join `orders` o on oi.order_id = o.id
where op.id = #{planId}
</select>
@@ -11,7 +11,7 @@
from order_plate a
LEFT JOIN order_item oi on a.id = oi.plate_id and a.order_id = oi.order_id and a.organ_id = oi.organ_id
LEFT JOIN `order` b on a.order_id = b.id and a.organ_id = b.organ_id
LEFT JOIN `orders` b on a.order_id = b.id and a.organ_id = b.organ_id
LEFT JOIN order_goods c on a.goods_id = c.id and a.organ_id = c.organ_id
left join order_plan_item opi on oi.id = opi.item_id and oi.organ_id = opi.organ_id
<where>
@@ -216,6 +216,8 @@
op.width,
op.thickness,
op.area,
op.is_special_shaped,
op.is_sculpt,
ogs.price,
ogs.brand,
ogs.height as goods_height,
@@ -235,6 +237,7 @@
left join order_goods gods on gods.id = op.goods_id
where op.order_id = #{orderId}
and op.organ_id = #{organId}
and op.deleted = #{deleted}
</select>
<select id="selectPlateGoodsListSummary" resultType="com.cf.imes.module.executor.controller.admin.plate.vo.PlateGoodsRespVO">
@@ -261,6 +264,7 @@
left join order_goods gods on gods.id = op.goods_id
where op.order_id = #{orderId}
and op.organ_id = #{organId}
and op.deleted = #{deleted}
</select>
<update id="updateDeletedById">
@@ -271,4 +275,8 @@
WHERE body_id = #{bodyId} AND organ_id = #{organId}
)
</update>
<select id="countPlateByOrderId" resultType="java.lang.Integer">
SELECT count(*) FROM order_plate
WHERE order_id = #{orderId} AND organ_id = #{organId} AND deleted = #{deleted}
</select>
</mapper>