24282 1 anno fa
parent
commit
68417cb7d7
17 ha cambiato i file con 400 aggiunte e 16 eliminazioni
  1. 71 0
      sd-business/src/main/java/com/sd/business/controller/statement/StatementOfAccountController.java
  2. 17 0
      sd-business/src/main/java/com/sd/business/entity/statement/dto/StatementOfAccountDto.java
  3. 17 0
      sd-business/src/main/java/com/sd/business/entity/statement/dto/StatementOfAccountSelectDto.java
  4. 59 0
      sd-business/src/main/java/com/sd/business/entity/statement/po/StatementOfAccount.java
  5. 17 0
      sd-business/src/main/java/com/sd/business/entity/statement/vo/StatementOfAccountVo.java
  6. 2 0
      sd-business/src/main/java/com/sd/business/mapper/production/ProductionOrderMapper.java
  7. 26 0
      sd-business/src/main/java/com/sd/business/mapper/statement/StatementOfAccountMapper.java
  8. 2 6
      sd-business/src/main/java/com/sd/business/service/production/impl/ProductionOrderServiceImpl.java
  9. 46 0
      sd-business/src/main/java/com/sd/business/service/statement/StatementOfAccountService.java
  10. 57 0
      sd-business/src/main/java/com/sd/business/service/statement/impl/StatementOfAccountServiceImpl.java
  11. 0 0
      sd-business/src/main/resources/mapper/production/ProductionOrderMapper.xml
  12. 20 0
      sd-business/src/main/resources/mapper/statement/StatementOfAccountMapper.xml
  13. 12 8
      sd-wln/src/main/java/com/sd/wln/scheduled/WlnSyncTask.java
  14. 3 0
      sd-wln/src/main/java/com/sd/wln/service/WlnOutboundOrderService.java
  15. 7 0
      sd-wln/src/main/java/com/sd/wln/service/WlnStatementOfAccount.java
  16. 1 2
      sd-wln/src/main/java/com/sd/wln/service/impl/WlnOutboundOrderServiceImpl.java
  17. 43 0
      sd-wln/src/main/java/com/sd/wln/service/impl/WlnStatementOfAccountImpl.java

+ 71 - 0
sd-business/src/main/java/com/sd/business/controller/statement/StatementOfAccountController.java

@@ -0,0 +1,71 @@
+package com.sd.business.controller.statement;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.common.core.domain.BaseSelectDto;
+import com.sd.business.entity.statement.dto.StatementOfAccountDto;
+import com.sd.business.entity.statement.dto.StatementOfAccountSelectDto;
+import com.sd.business.entity.statement.vo.StatementOfAccountVo;
+import com.sd.business.service.statement.StatementOfAccountService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+
+/**
+ * <p>
+ * 对账单 前端控制器
+ * </p>
+ *
+ * @author
+ * @since 2023-07-31
+ */
+@RestController
+@RequestMapping("/statementOfAccount")
+public class StatementOfAccountController {
+
+    @Autowired
+    private StatementOfAccountService statementOfAccountService;
+
+    /**
+     * 对账单分页
+     */
+    @PostMapping("/page")
+    public Page<StatementOfAccountVo> page(@RequestBody StatementOfAccountSelectDto dto) {
+        return statementOfAccountService.getPage(dto);
+    }
+
+    /**
+     * 对账单明细
+     */
+    @PostMapping("/detail")
+    public StatementOfAccountVo detail(@RequestBody BaseSelectDto dto) {
+        return statementOfAccountService.detail(dto.getId());
+    }
+
+    /**
+     * 对账单新增
+     */
+    @PostMapping("/add")
+    public void add(@RequestBody StatementOfAccountDto statementOfAccountDto) {
+        statementOfAccountService.add(statementOfAccountDto);
+    }
+
+    /**
+     * 对账单编辑
+     */
+    @PostMapping("/edit")
+    public void edit(@RequestBody StatementOfAccountDto statementOfAccountDto) {
+        statementOfAccountService.edit(statementOfAccountDto);
+    }
+
+    /**
+     * 对账单删除
+     */
+    @PostMapping("/delete")
+    public void delete(@RequestBody BaseSelectDto dto) {
+        statementOfAccountService.delete(dto.getId());
+    }
+
+}

+ 17 - 0
sd-business/src/main/java/com/sd/business/entity/statement/dto/StatementOfAccountDto.java

@@ -0,0 +1,17 @@
+package com.sd.business.entity.statement.dto;
+
+import com.sd.business.entity.statement.po.StatementOfAccount;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * 对账单新增编辑入参实体
+ *
+ * @author
+ * @since 2023-07-31
+ */
+@Getter
+@Setter
+public class StatementOfAccountDto extends StatementOfAccount {
+
+}

+ 17 - 0
sd-business/src/main/java/com/sd/business/entity/statement/dto/StatementOfAccountSelectDto.java

@@ -0,0 +1,17 @@
+package com.sd.business.entity.statement.dto;
+
+import com.ruoyi.common.core.domain.BaseSelectDto;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * 对账单列表查询入参实体
+ *
+ * @author
+ * @since 2023-07-31
+ */
+@Getter
+@Setter
+public class StatementOfAccountSelectDto extends BaseSelectDto {
+
+}

+ 59 - 0
sd-business/src/main/java/com/sd/business/entity/statement/po/StatementOfAccount.java

@@ -0,0 +1,59 @@
+package com.sd.business.entity.statement.po;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.ruoyi.common.core.domain.BasePo;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * <p>
+ * 对账单
+ * </p>
+ *
+ * @author
+ * @since 2023-07-31
+ */
+@Getter
+@Setter
+@TableName("statement_of_account")
+public class StatementOfAccount extends BasePo {
+
+    /**
+     * 对账单号
+     */
+    private String code;
+
+    /**
+     * 事业部id
+     */
+    private Long departmentId;
+
+    /**
+     * 对账金额
+     */
+    private BigDecimal amount;
+
+    /**
+     * 对账时间段开始时间
+     */
+    private Date timePeriodStart;
+
+    /**
+     * 对账时间段结束时间
+     */
+    private Date timePeriodEnd;
+
+    /**
+     * 订单id关联
+     */
+    private String orderIdJoin;
+
+    /**
+     * 类型 1用户自建 2系统生成
+     */
+    private Integer type;
+
+}

+ 17 - 0
sd-business/src/main/java/com/sd/business/entity/statement/vo/StatementOfAccountVo.java

@@ -0,0 +1,17 @@
+package com.sd.business.entity.statement.vo;
+
+import com.sd.business.entity.statement.po.StatementOfAccount;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * 对账单列表查询返回值实体
+ *
+ * @author
+ * @since 2023-07-31
+ */
+@Getter
+@Setter
+public class StatementOfAccountVo extends StatementOfAccount {
+
+}

+ 2 - 0
sd-business/src/main/java/com/sd/business/mapper/production/ProductionOrderMapper.java

@@ -3,8 +3,10 @@ package com.sd.business.mapper.production;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.ruoyi.common.utils.wrapper.IWrapper;
 import com.sd.business.entity.production.vo.ProductionOrderVo;
+import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 
+@Mapper
 public interface ProductionOrderMapper {
 
     Page<ProductionOrderVo> getPage(@Param("page") Page<Object> page, @Param("ew") IWrapper<ProductionOrderVo> wrapper);

+ 26 - 0
sd-business/src/main/java/com/sd/business/mapper/statement/StatementOfAccountMapper.java

@@ -0,0 +1,26 @@
+package com.sd.business.mapper.statement;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.common.utils.wrapper.IWrapper;
+import com.sd.business.entity.statement.po.StatementOfAccount;
+import com.sd.business.entity.statement.vo.StatementOfAccountVo;
+import org.apache.ibatis.annotations.Param;
+
+
+/**
+ * <p>
+ * 对账单 Mapper 接口
+ * </p>
+ *
+ * @author
+ * @since 2023-07-31
+ */
+public interface StatementOfAccountMapper extends BaseMapper<StatementOfAccount> {
+
+    /**
+     * 对账单分页
+     */
+    Page<StatementOfAccountVo> getPage(@Param("page") Page<Object> page, @Param("ew") IWrapper<StatementOfAccount> wrapper);
+
+}

+ 2 - 6
sd-business/src/main/java/com/sd/business/service/production/impl/ProductionOrderServiceImpl.java

@@ -26,13 +26,11 @@ import com.sd.business.service.order.OrderSkuService;
 import com.sd.business.service.production.ProductionOrderService;
 import com.sd.business.service.production.ProductionTaskService;
 import com.sd.business.service.sku.SkuService;
-import com.sd.business.service.sku.SkuSpecLinkService;
 import com.sd.business.service.sku.SkuSpecService;
 import com.sd.framework.util.Assert;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
-import javax.annotation.Resource;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
@@ -42,7 +40,7 @@ import java.util.stream.Collectors;
 @Service
 public class ProductionOrderServiceImpl implements ProductionOrderService {
 
-    @Resource
+    @Autowired
     private ProductionOrderMapper productionOrderMapper;
 
     @Autowired
@@ -61,9 +59,6 @@ public class ProductionOrderServiceImpl implements ProductionOrderService {
     private OrderSkuService orderSkuService;
 
     @Autowired
-    private SkuSpecLinkService skuSpecLinkService;
-
-    @Autowired
     private BomSpecService bomSpecService;
 
     @Autowired
@@ -74,6 +69,7 @@ public class ProductionOrderServiceImpl implements ProductionOrderService {
 
         IWrapper<ProductionOrderVo> wrapper = IWrapper.getWrapper();
         wrapper.gt("oi", OrderInfo::getStatus, OrderStatusEnum.STOCK_PREPARATION.getKey());
+        wrapper.notIn("oi", OrderInfo::getStatus, OrderStatusEnum.DELETE.getKey(), OrderStatusEnum.EXCEPTION.getKey());
         wrapper.like("oi", OrderInfo::getCode, dto.getCode());
         wrapper.like("oi", OrderInfo::getWlnCode, dto.getWlnCode());
         wrapper.eq("oi", OrderInfo::getDepartmentId, dto.getDepartmentId());

+ 46 - 0
sd-business/src/main/java/com/sd/business/service/statement/StatementOfAccountService.java

@@ -0,0 +1,46 @@
+package com.sd.business.service.statement;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.common.core.service.BaseService;
+import com.sd.business.entity.statement.dto.StatementOfAccountDto;
+import com.sd.business.entity.statement.dto.StatementOfAccountSelectDto;
+import com.sd.business.entity.statement.po.StatementOfAccount;
+import com.sd.business.entity.statement.vo.StatementOfAccountVo;
+
+
+/**
+ * <p>
+ * 对账单 服务类
+ * </p>
+ *
+ * @author
+ * @since 2023-07-31
+ */
+public interface StatementOfAccountService extends BaseService<StatementOfAccount> {
+
+    /**
+     * 对账单分页
+     */
+    Page<StatementOfAccountVo> getPage(StatementOfAccountSelectDto dto);
+
+    /**
+     * 对账单明细
+     */
+    StatementOfAccountVo detail(Long id);
+
+    /**
+     * 对账单新增
+     */
+    void add(StatementOfAccountDto statementOfAccountDto);
+
+    /**
+     * 对账单编辑
+     */
+    void edit(StatementOfAccountDto statementOfAccountDto);
+
+    /**
+     * 对账单删除
+     */
+    void delete(Long id);
+
+}

+ 57 - 0
sd-business/src/main/java/com/sd/business/service/statement/impl/StatementOfAccountServiceImpl.java

@@ -0,0 +1,57 @@
+package com.sd.business.service.statement.impl;
+
+import cn.hutool.core.bean.BeanUtil;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.common.utils.wrapper.IWrapper;
+import com.sd.business.entity.statement.dto.StatementOfAccountDto;
+import com.sd.business.entity.statement.dto.StatementOfAccountSelectDto;
+import com.sd.business.entity.statement.po.StatementOfAccount;
+import com.sd.business.entity.statement.vo.StatementOfAccountVo;
+import com.sd.business.mapper.statement.StatementOfAccountMapper;
+import com.sd.business.service.statement.StatementOfAccountService;
+import org.springframework.stereotype.Service;
+
+
+/**
+ * <p>
+ * 对账单 服务实现类
+ * </p>
+ *
+ * @author
+ * @since 2023-07-31
+ */
+@Service
+public class StatementOfAccountServiceImpl extends ServiceImpl<StatementOfAccountMapper, StatementOfAccount> implements StatementOfAccountService {
+
+    @Override
+    public Page<StatementOfAccountVo> getPage(StatementOfAccountSelectDto dto) {
+        IWrapper<StatementOfAccount> wrapper = getWrapper();
+        wrapper.orderByDesc("soa", StatementOfAccount::getId);
+        Page<StatementOfAccountVo> page = this.baseMapper.getPage(dto.getPage(), wrapper);
+        return page;
+    }
+
+    @Override
+    public StatementOfAccountVo detail(Long id) {
+        StatementOfAccount StatementOfAccount = this.getById(id);
+        StatementOfAccountVo result = BeanUtil.toBean(StatementOfAccount, StatementOfAccountVo.class);
+        return result;
+    }
+
+    @Override
+    public void add(StatementOfAccountDto statementOfAccountDto) {
+        this.save(statementOfAccountDto);
+    }
+
+    @Override
+    public void edit(StatementOfAccountDto statementOfAccountDto) {
+        this.updateById(statementOfAccountDto);
+    }
+
+    @Override
+    public void delete(Long id) {
+        this.removeById(id);
+    }
+
+}

+ 0 - 0
sd-business/src/main/resources/mapper/production/ProductionOrderService.xml → sd-business/src/main/resources/mapper/production/ProductionOrderMapper.xml


+ 20 - 0
sd-business/src/main/resources/mapper/statement/StatementOfAccountMapper.xml

@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.sd.business.mapper.statement.StatementOfAccountMapper">
+    <select id="getPage" resultType="com.sd.business.entity.statement.vo.StatementOfAccountVo">
+        select soa.id,
+               soa.code,
+               soa.department_id,
+               soa.amount,
+               soa.time_period_start,
+               soa.time_period_end,
+               soa.order_id_join,
+               soa.create_user,
+               soa.create_time,
+               soa.update_user,
+               soa.update_time
+        from statement_of_account soa
+            ${ew.customSqlSegment}
+    </select>
+
+</mapper>

+ 12 - 8
sd-wln/src/main/java/com/sd/wln/scheduled/WlnSyncTask.java

@@ -3,6 +3,7 @@ package com.sd.wln.scheduled;
 import com.sd.wln.service.WlnOrderService;
 import com.sd.wln.service.WlnOutboundOrderService;
 import com.sd.wln.service.WlnSkuService;
+import com.sd.wln.service.WlnStatementOfAccount;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Profile;
 import org.springframework.scheduling.annotation.Scheduled;
@@ -24,6 +25,9 @@ public class WlnSyncTask {
     @Autowired
     private WlnOutboundOrderService wlnOutboundOrderService;
 
+    @Autowired
+    private WlnStatementOfAccount wlnStatementOfAccount;
+
     /**
      * 每天凌晨1点同步一次sku信息
      */
@@ -54,19 +58,19 @@ public class WlnSyncTask {
     }
 
     /**
-     * 每5分钟同步一次出库单数据
+     * 每10分钟同步一次出库单数据
      */
     @Scheduled(fixedDelay = 10 * 60 * 1000)
     private void syncOutboundOrder() {
         wlnOutboundOrderService.syncOutboundOrder();
     }
 
-    // /**
-    //  * 生成对账单
-    //  */
-    // @Scheduled(cron = "0 0 19-22 * * ?")
-    // private void createStatementOfAccount() {
-    //     wlnOutboundOrderService.syncOutboundOrder();
-    // }
+    /**
+     * 生成对账单
+     */
+    @Scheduled(cron = "0 0 19-23 * * ?")
+    private void createStatementOfAccount() {
+        wlnStatementOfAccount.createStatementOfAccount();
+    }
 
 }

+ 3 - 0
sd-wln/src/main/java/com/sd/wln/service/WlnOutboundOrderService.java

@@ -2,6 +2,9 @@ package com.sd.wln.service;
 
 public interface WlnOutboundOrderService {
 
+    /**
+     * 每10分钟同步一次出库单数据
+     */
     void syncOutboundOrder();
 
 }

+ 7 - 0
sd-wln/src/main/java/com/sd/wln/service/WlnStatementOfAccount.java

@@ -0,0 +1,7 @@
+package com.sd.wln.service;
+
+public interface WlnStatementOfAccount {
+
+    void createStatementOfAccount();
+
+}

+ 1 - 2
sd-wln/src/main/java/com/sd/wln/service/impl/WlnOutboundOrderServiceImpl.java

@@ -85,8 +85,7 @@ public class WlnOutboundOrderServiceImpl implements WlnOutboundOrderService {
      * 查询近万里牛出库单
      */
     private List<JSONObject> getWlnOutboundOrder() {
-        OutboundOrder outboundOrder = outboundOrderService.getOne(
-                q -> q.orderByDesc(OutboundOrder::getOutboundTimestamp).last("limit 1"));
+        OutboundOrder outboundOrder = outboundOrderService.getOne(q -> q.orderByDesc(OutboundOrder::getOutboundTimestamp));
 
         long startTime;
         long endTime = System.currentTimeMillis();

+ 43 - 0
sd-wln/src/main/java/com/sd/wln/service/impl/WlnStatementOfAccountImpl.java

@@ -0,0 +1,43 @@
+package com.sd.wln.service.impl;
+
+import cn.hutool.core.date.DateUtil;
+import com.ruoyi.common.core.domain.BasePo;
+import com.sd.business.entity.outbound.po.OutboundOrder;
+import com.sd.business.entity.statement.po.StatementOfAccount;
+import com.sd.business.service.outbound.OutboundOrderService;
+import com.sd.business.service.statement.StatementOfAccountService;
+import com.sd.wln.service.WlnStatementOfAccount;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+@Service
+public class WlnStatementOfAccountImpl implements WlnStatementOfAccount {
+
+    @Autowired
+    private StatementOfAccountService statementOfAccountService;
+
+    @Autowired
+    private OutboundOrderService outboundOrderService;
+
+    @Override
+    public void createStatementOfAccount() {
+        Date date = new Date();
+
+        Map<Long, StatementOfAccount> statementOfAccountMap = statementOfAccountService.mapKEntity(
+                StatementOfAccount::getDepartmentId,
+                q -> q
+                        .eq(StatementOfAccount::getType, 2)
+                        .between(BasePo::getCreateTime, DateUtil.beginOfDay(date), DateUtil.endOfDay(date))
+        );
+
+        List<OutboundOrder> list = outboundOrderService.list(q -> q
+                .between(BasePo::getCreateTime, DateUtil.beginOfDay(date), DateUtil.endOfDay(date)));
+
+
+    }
+
+}