组织id修改

This commit is contained in:
lym
2024-08-20 14:02:54 +08:00
parent 199105091f
commit 7cf453050f
6 changed files with 69 additions and 68 deletions
@@ -67,7 +67,7 @@ public interface PlateMapper extends BaseMapperX<PlateDO> {
.orderByDesc(PlateDO::getId));
}
// IPage<PlatePage> selectPlatePage(@Param("page") IPage<PlatePage> page, @Param("orderId")Long organId, @Param("goodsId") String goodsId);
// IPage<PlatePage> selectPlatePage(@Param("page") IPage<PlatePage> page, @Param("orderId")Long organId, @Param("goodsId") String goodsId);
List<PlatePage> selectPlatePage( @Param("orderId") Long orderId,@Param("organId") Long organId/*, @Param("goodsId") String goodsId*/);
IPage<PlateResList> selectPlateByPlanId(@Param("page") IPage<PlateResList> page, @Param(Constants.WRAPPER) Wrapper<PlateDO> wrapper);
@@ -153,6 +153,15 @@ public class OrderServiceImpl implements OrderService {
if (updateReqVO.getCustomOrderNo() == null || updateReqVO.getCustomOrderNo().equals("")) {
updateObj.setCustomOrderNo("");
}
if (updateReqVO.getSalesman() == null || updateReqVO.getSalesman().equals("")) {
updateObj.setSalesman("");
}
if (updateReqVO.getSplitter() == null || updateReqVO.getSplitter().equals("")) {
updateObj.setSplitter("");
}
if (updateReqVO.getRemark() == null || updateReqVO.getRemark().equals("")) {
updateObj.setRemark("");
}
orderMapper.updateById(updateObj);
}
@@ -60,7 +60,7 @@ public class OrderScheduledImpl {
public static final String ORDER_PARTS_REMARK_MODEL = "imes_order_parts_remark_model";
// @Scheduled(cron = "0 0 2 * * ?")
// @Scheduled(cron = "0 0 2 * * ?")
@OrganIgnore
@Transactional(rollbackFor = Exception.class)
public void fixedDeletedOrder() {
@@ -21,6 +21,7 @@ import java.util.concurrent.Future;
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.*;
/**
* api数据获取
*/
@@ -35,9 +36,8 @@ public class ApiDataAchieve {
private ApplicationApi applicationApi;
private static final int PARTS_PAGE_MAX = 100;
private static final int PARTS_PAGE_MAX_Test = 95;
// 获得token数据
// 获得token数据
public Future<JSONObject> getApiToken(Long organId) {
JSONObject app = applicationApi.getApplicationByOrganId(organId);
String appId = app.getString("appId");
@@ -45,14 +45,14 @@ public class ApiDataAchieve {
JSONObject json = apiDataProduction.getApiTokenMessage(appId, appSecret);
if (!json.getString("err_msg").equals("success")) {
// throw exception(APP_TOKEN_ERROR);
throw exception(APP_TOKEN_ERROR);
}
// String token = json.getJSONObject("info").getString("access_token");
return new AsyncResult<>(json);
}
// 获取板件生产数据信息
// @Async
// 获取板件生产数据信息
@Async
public Future<JSONObject> getApiPlateProData(String token, String orderNo) {
JSONObject jsonPlatesData = new JSONObject();
jsonPlatesData.put("order_no", orderNo);//生产单号需要传入赋值
@@ -62,8 +62,8 @@ public class ApiDataAchieve {
return new AsyncResult<>(dataPlates);
}
// 获取配件信息 分页获取
// @Async
// 获取配件信息 分页获取
@Async
public Future<JSONObject> getApiPartsMessage(String token, String orderNo) {
JSONObject jsonParts = new JSONObject();
jsonParts.put("curr_page", 1);
@@ -72,7 +72,7 @@ public class ApiDataAchieve {
JSONObject parts = apiDataProduction.getApiOrderPartsMessage(token, jsonParts);
if (!parts.getString("err_code").equals("0")) {
log.error("配件数据获取错误" + orderNo);
// throw exception(PARTS_DATA_ERROR);
throw exception(PARTS_DATA_ERROR);
}
JSONObject dataParts = new JSONObject();
for (int i = 1; i <= parts.getJSONObject("value").getInteger("PageCount"); i++) {
@@ -83,8 +83,8 @@ public class ApiDataAchieve {
return new AsyncResult<>(dataParts);
}
// 柜体信息转换
// @Async
// 柜体信息转换
@Async
public Future<JSONObject> getApiBodyMessage(String token, String orderNo) {
JSONObject jsonBody = new JSONObject();
jsonBody.put("curr_page", 1);
@@ -93,7 +93,7 @@ public class ApiDataAchieve {
JSONObject body = apiDataProduction.getApiOrderBodyMessage(token, jsonBody);
if (!body.getString("err_code").equals("0")) {
log.error("柜体数据获取错误" + orderNo);
// throw exception(BODY_DATA_ERROR);
throw exception(BODY_DATA_ERROR);
}
JSONObject dataBody = new JSONObject();
for (int i = 1; i <= body.getJSONObject("value").getInteger("PageCount"); i++) {
@@ -104,8 +104,8 @@ public class ApiDataAchieve {
return new AsyncResult<>(dataBody);
}
// 商品信息转换
// @Async
// 商品信息转换
@Async
public Future<JSONObject> getApiGoodsMessage(String token, String orderNo) {
JSONObject jsonGoods = new JSONObject();
jsonGoods.put("curr_page", 1);
@@ -114,7 +114,7 @@ public class ApiDataAchieve {
JSONObject goods = apiDataProduction.getApiOrderGoodsMessage(token, jsonGoods);
if (!goods.getString("err_code").equals("0")) {
log.error("商品信息转换失败" + orderNo);
// throw exception(GOODS_DATA_ERROR);
throw exception(GOODS_DATA_ERROR);
}
JSONObject dataGoods = new JSONObject();
for (int i = 1; i <= goods.getJSONObject("value").getInteger("PageCount"); i++) {
@@ -125,8 +125,8 @@ public class ApiDataAchieve {
return new AsyncResult<>(dataGoods);
}
// 板材明细信息转换
// @Async
// 板材明细信息转换
@Async
public Future<JSONObject> getApiPlateDetailMessage(String token, String orderNo) {
JSONObject jsonPlates = new JSONObject();
jsonPlates.put("curr_page", 1);
@@ -135,7 +135,7 @@ public class ApiDataAchieve {
JSONObject plates = apiDataProduction.getApiBlocksDataMessage(token, jsonPlates);
if (!plates.getString("err_code").equals("0")) {
log.error("板材明细获取错误" + orderNo);
// throw exception(PLATE_DATA_ERROR);
throw exception(PLATE_DATA_ERROR);
}
JSONObject plate = new JSONObject();
for (int i = 1; i <= plates.getJSONObject("value").getInteger("PageCount"); i++) {
@@ -146,8 +146,8 @@ public class ApiDataAchieve {
return new AsyncResult<>(plate);
}
// 加工组信息转换
// @Async
// 加工组信息转换
@Async
public Future<JSONObject> getApiGroupMessage(String token, String orderNo) {
JSONObject jsonModule = new JSONObject();
jsonModule.put("order_no", orderNo);
@@ -155,8 +155,8 @@ public class ApiDataAchieve {
return new AsyncResult<>(dataModule);
}
// 板材数据信息转换
// @Async
// 板材数据信息转换
@Async
public Future<JSONObject> getApiBlocksMessage(String token, String orderNo) {
JSONObject jsonBlocks = new JSONObject();
jsonBlocks.put("curr_page", 1);
@@ -177,21 +177,15 @@ public class ApiDataAchieve {
return new AsyncResult<>(block);
}
// 订单获取
// 订单获取
public Future<JSONObject> getApiOrder(String token, String shopId, String orderNo) {
JSONObject jsonOrders = new JSONObject();
jsonOrders.put("order_no", shopId + "@N" +orderNo);
JSONObject order = apiDataProduction.getApiOrderList(token, jsonOrders);
return new AsyncResult<>(order);
}
public Future<JSONObject> getApiOrder(String token) { // 批量导入专用,之后删除
JSONObject jsonOrders = new JSONObject();
jsonOrders.put("page_count", PARTS_PAGE_MAX_Test );
JSONObject order = apiDataProduction.getApiOrderList(token, jsonOrders);
return new AsyncResult<>(order);
}
// 订单列表
// 订单列表
public Future<JSONObject> getApiOrderList(String token,String shopId,String createDateMin, String createDateMax, String orderNo, String customOrderNo) {
JSONObject jsonOrders = new JSONObject();
if (createDateMin != null && createDateMax != null){
@@ -203,7 +197,7 @@ public class ApiDataAchieve {
LocalDate endTime = LocalDate.parse(createDateMax, formatter);
long daysBetweenSimple = ChronoUnit.DAYS.between(startTime, endTime);
if (daysBetweenSimple > 30) {
// throw exception(ORDER_DATE_ERR);
throw exception(ORDER_DATE_ERR);
}
jsonOrders.put("create_date_min", createDateMin + " 00:00:00");
@@ -222,7 +216,7 @@ public class ApiDataAchieve {
JSONObject orders = apiDataProduction.getApiOrderList(token, jsonOrders);
if (!orders.getString("err_code").equals("0")) {
// throw exception(ORDER_READ_ERR);
throw exception(ORDER_READ_ERR);
}
JSONObject order = new JSONObject();
int countPage = divideWithPlusOne(orders.getInteger("count"), PARTS_PAGE_MAX);
@@ -274,7 +268,7 @@ public class ApiDataAchieve {
public int divideWithPlusOne(int dividend, int divisor) {
// 首先检查除数是否为0,避免除以0的异常
if (divisor == 0) {
// throw new IllegalArgumentException("除数不能为0");
throw new IllegalArgumentException("除数不能为0");
}
// 计算商和余数
@@ -78,31 +78,31 @@ public class ApiTypeRealize {
Long orderId = (Long) identifierGenerator.nextId(null);
// 获取组织id 之后删除
Long orgId = 325L;
// Long orgId = 325L;
// 生产单数据
OrderDO orderDO = orderInfoChange(order, orderId, orderNo, orgId);
OrderDO orderDO = orderInfoChange(order, orderId, orderNo);
List<OrderDO> orderList = new ArrayList<>();
orderList.add(orderDO);
// 商品信息数据 信息以全
Map<String, Map<Long, ?>> goodsInfoChange = rawGoodsInfoChange(dataGoods, orderId, dataBlocks, orgId);
Map<String, Map<Long, ?>> goodsInfoChange = rawGoodsInfoChange(dataGoods, orderId, dataBlocks);
List<GoodsDO> goodsDO = (List<GoodsDO>) goodsInfoChange.get("goodsDOS").values().stream().collect(Collectors.toList());
map.put("goodsDO", goodsDO);
List<RawGoodsDO> rawGoodsDO = (List<RawGoodsDO>) goodsInfoChange.get("rawGoodsDOS").values().stream().collect(Collectors.toList());
map.put("rawGoodsDO", rawGoodsDO);
// 柜体信息 少异形数量、板材数量
Map<Long, OrderBodyDO> bodyInfoChange = bodyInfoChange(dataBody, orderId, orgId);
Map<Long, OrderBodyDO> bodyInfoChange = bodyInfoChange(dataBody, orderId);
// 加工组 少异形数量、板材数量
Map<String, Map<Long, ?>> group =
groupInfoChange(dataModule, orderId, bodyInfoChange, orgId);
groupInfoChange(dataModule, orderId, bodyInfoChange);
Map<Long, OrderGroupDO> orderGroupDO = (Map<Long, OrderGroupDO>) group.get("orderGroup");
Map<Long, List<Long>> groupLists = (Map<Long, List<Long>>) group.get("lists"); // 加工组中包含的板件、配件id
// 配件
Map<String, Map<Long, ?>> partsDO = partsInfoChange(dataParts, orderId,
(Map<Long, GoodsDO>) goodsInfoChange.get("goodsDOS"), bodyInfoChange, orgId);
(Map<Long, GoodsDO>) goodsInfoChange.get("goodsDOS"), bodyInfoChange);
Map<Long, OrderPartsRemark> partsRemark = (Map<Long, OrderPartsRemark>) partsDO.get("remarks"); // 配件备注
map.put("partsRemark", partsRemark.values().stream().collect(Collectors.toList()));
@@ -117,7 +117,7 @@ public class ApiTypeRealize {
itemsList.addAll(partsItems.values());
// 板材 写库
Map<String, Map<Long, ?>> platesDO = platesInfoChange(dataPlates, plates, orderId,
(Map<Long, GoodsDO>) goodsInfoChange.get("goodsDOS"), bodyInfoChange, dataBlocks, orgId);
(Map<Long, GoodsDO>) goodsInfoChange.get("goodsDOS"), bodyInfoChange, dataBlocks);
Map<Long, PlateDO> orderPlatesDO = (Map<Long, PlateDO>) platesDO.get("platesInfos");
map.put("platesDO", orderPlatesDO.values().stream().collect(Collectors.toList()));
map.put("plateDetail", platesDO.get("plateDetail").values().stream().collect(Collectors.toList()));
@@ -221,7 +221,7 @@ public class ApiTypeRealize {
/**
* 加工组 信息转换
*/
private Map<String, Map<Long, ?>> groupInfoChange(JSONObject dataModule, Long orderId, Map<Long, OrderBodyDO> bodyInfoChange, Long organId) {
private Map<String, Map<Long, ?>> groupInfoChange(JSONObject dataModule, Long orderId, Map<Long, OrderBodyDO> bodyInfoChange) {
Map<String, Map<Long, ?>> map = new HashMap<>();
Map<Long, OrderGroupDO> orderGroupDOs = new HashMap<>();// 加工组id 和 加工组信息
Map<Long, List<Long>> groupLists = new HashMap<>();// 加工组id 和 详细信息
@@ -248,7 +248,6 @@ public class ApiTypeRealize {
.unregularNum(0)
.filename("")
.remark("")
.organId(organId)
.build();
groupLists.put(group.getLong("ModuleID"), jsonArrayToList(group.getJSONArray("ItemIDList")));
orderGroupDOs.put(group.getLong("ModuleID"), bodyInfo);
@@ -268,7 +267,7 @@ public class ApiTypeRealize {
* @author Administrator
* @date 2024/4/30
*/
public OrderDO orderInfoChange(JSONObject orderJson, Long orderId, String orderNo, Long organId) {
public OrderDO orderInfoChange(JSONObject orderJson, Long orderId, String orderNo) {
// 获取 Orders 字段对应的数组
JSONObject order = orderJson.getJSONArray("data").getJSONObject(0);
@@ -306,7 +305,6 @@ public class ApiTypeRealize {
// .splitter("")
.splitter(order.getString("cd_nick_name"))
.remark(orderRemark + order.getString("comments"))
.organId(organId)
.build();
Integer submitState = order.getInteger("submit_state");
@@ -346,7 +344,7 @@ public class ApiTypeRealize {
* @author Administrator
* @date 2024/4/30
*/
public Map<String, Map<Long, ?>> rawGoodsInfoChange(JSONObject dataRawGoods, Long orderId, JSONObject dataBlocks, Long organId) {
public Map<String, Map<Long, ?>> rawGoodsInfoChange(JSONObject dataRawGoods, Long orderId, JSONObject dataBlocks) {
Map<String, Map<Long, ?>> map = new HashMap<>();
Map<Long, RawGoodsDO> rawGoodsDOS = new HashMap<>();
Map<Long, GoodsDO> goodsDOS = new HashMap<>();
@@ -369,7 +367,6 @@ public class ApiTypeRealize {
.price(goods.getDouble("Price"))
.brand(goods.getString("Brand"))
.spec(goods.getString("Spec"))
.organId(organId)
.build();
rawGoodsDOS.put(goods.getLong("GoodsID"), rawGoodsDO);
@@ -388,7 +385,6 @@ public class ApiTypeRealize {
.price(BigDecimal.valueOf(goods.getDouble("Price")))
.brand(goods.getString("Brand"))
.spec(goods.getString("Spec"))
.organId(organId)
.build();
goodsDOS.put(goods.getLong("GoodsID"), goodsDO);
@@ -408,7 +404,7 @@ public class ApiTypeRealize {
* @author Administrator
* @date 2024/4/30
*/
private Map<Long, OrderBodyDO> bodyInfoChange(JSONObject dataBody, Long orderId, Long organId) {
private Map<Long, OrderBodyDO> bodyInfoChange(JSONObject dataBody, Long orderId) {
Map<Long, OrderBodyDO> bodyInfos = new HashMap<>();
if (dataBody.getJSONArray("List") != null &&
@@ -430,7 +426,6 @@ public class ApiTypeRealize {
.unregularNum(0)
.filename("")
.remark("")
.organId(organId)
.build();
bodyInfos.put(body.getLong("BoxID"), bodyInfo);
@@ -461,7 +456,7 @@ public class ApiTypeRealize {
* @author Administrator
* @date 2024/4/30
*/
public Map<String, Map<Long, ?>> partsInfoChange(JSONObject value, Long orderId, Map<Long, GoodsDO> goodsDOMap, Map<Long, OrderBodyDO> bodyInfos, Long organId) {
public Map<String, Map<Long, ?>> partsInfoChange(JSONObject value, Long orderId, Map<Long, GoodsDO> goodsDOMap, Map<Long, OrderBodyDO> bodyInfos) {
Map<String, Map<Long, ?>> map = new HashMap<>();
Map<Long, OrderPartsDO> partsInfos = new HashMap<>();
Map<Long, OrderItemDO> partsItem = new HashMap<>();
@@ -489,7 +484,6 @@ public class ApiTypeRealize {
.price(parts.getDouble("Price"))
.isComposite(parts.getBoolean("IsComposite"))
.remark(parts.getString("Remark"))
.organId(organId)
.build();
remarks.put(parts.getLong("ItemID"), partsRemarkChange(parts, orderId, partsId));
partsInfos.put(parts.getLong("ItemID"), partsInfo);
@@ -506,7 +500,6 @@ public class ApiTypeRealize {
.groupId(0L)
.partsId(partsId)
.num(parts.getDouble("Num"))
.organId(organId)
.build();
partsItem.put(parts.getLong("ItemID"), item);
}
@@ -541,7 +534,7 @@ public class ApiTypeRealize {
*/
private Map<String, Map<Long, ?>> platesInfoChange(JSONObject value, JSONObject dataPlates, Long orderId,
Map<Long, GoodsDO> goodsDOMap, Map<Long, OrderBodyDO> bodyInfos,
JSONObject dataBlocks, Long organId) {
JSONObject dataBlocks) {
// 板材 写ES
Map<Long, PlateDetail> plateDetail = platesDetailChange(value);
@@ -604,7 +597,6 @@ public class ApiTypeRealize {
.isCancel(false)
.filterType("")
.remark(remark)
.organId(organId)
.build();
// item 明细
@@ -619,7 +611,6 @@ public class ApiTypeRealize {
.groupId(0L)
.partsId(0L)
.plateId(plateId)
.organId(organId)
.num(1.0)
.build();
@@ -14,15 +14,15 @@
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>
a.organ_id = #{organId}
and a.is_cancel = 0
and opi.item_id is null
<if test="orderId !=null">
and a.order_id = #{orderId}
</if>
<where>
a.organ_id = #{organId}
and a.is_cancel = 0
and opi.item_id is null
<if test="orderId !=null">
and a.order_id = #{orderId}
</if>
</where>
</where>
</select>
@@ -40,9 +40,16 @@
</select>
<select id="selectPlateList"
resultType="com.cf.imes.module.executor.controller.admin.plan.vo.PlateParam">
select distinct a.id, a.plate_no, a.height length, a.width, a.texture, a.hole_arrange, a.hole_face, if ( (count(a.unregular_point_count) = 0), 1, 0) as isRect
select distinct a.id,
a.plate_no,
a.height length,
a.width,
a.texture,
a.hole_arrange,
a.hole_face,
if((count(a.unregular_point_count) = 0), 1, 0) as isRect
from order_plate a
left join order_item b on a.id = b.plate_id
left join order_item b on a.id = b.plate_id
where b.plan_id = #{planId}
group by a.id
@@ -51,8 +58,8 @@
<select id="selectProductList"
resultType="com.cf.imes.module.executor.controller.admin.plate.vo.PlateRespVO">
SELECT DISTINCT a.id, a.plate_no, a.height, a.thickness, a.width, a.name, a.area, a.seal_left, a.seal_right,
a.seal_up, a.seal_down, a.texture, a.hole_face, a.hole_arrange, a.unregular_point_count, a.front_hole_count, a.back_hole_count,
a.side_hole_count, a.front_model_count, a.back_model_count, a.remark, c.material, c.color
a.seal_up, a.seal_down, a.texture, a.hole_face, a.hole_arrange, a.unregular_point_count, a.front_hole_count, a.back_hole_count,
a.side_hole_count, a.front_model_count, a.back_model_count, a.remark, c.material, c.color
FROM order_plate a
LEFT JOIN order_goods c ON a.goods_id = c.id AND a.order_id = c.order_id and a.organ_id = c.organ_id
LEFT JOIN order_item b ON a.id = b.plate_id and a.organ_id = b.organ_id