yzc 1 жил өмнө
parent
commit
a6f8b34252

+ 2 - 1
hx-mes/src/main/resources/mapper/production/ProduceOrderMapper.xml

@@ -16,7 +16,8 @@
 			   c.prod_tag,
 			   c.prod_remark,
 			   po.finish_time,
-			   (if(IFNULL(po.finish_time, NOW()) > po.delivery_period, 1, 0)) AS isOverdue
+			   (if(IFNULL(po.finish_time, NOW()) > po.delivery_period, 1, 0)) AS isOverdue,
+			   po.confirm_status
 		from production_order po
 				 LEFT JOIN contract c ON po.contract_id = c.id
 			${ew.customSqlSegment}

+ 2 - 0
hx-sale/src/main/java/com/fjhx/sale/entity/after/dto/AfterSalesSelectDto.java

@@ -14,4 +14,6 @@ import lombok.Setter;
 @Setter
 public class AfterSalesSelectDto extends BaseSelectDto {
 
+    private Long companyId;
+
 }

+ 2 - 0
hx-sale/src/main/java/com/fjhx/sale/entity/after/po/AfterSales.java

@@ -73,4 +73,6 @@ public class AfterSales extends BasePo {
      */
     private Long quantity;
 
+    private Long companyId;
+
 }

+ 5 - 0
hx-sale/src/main/java/com/fjhx/sale/entity/purchase/dto/PurchaseBackSelectDto.java

@@ -14,4 +14,9 @@ import lombok.Setter;
 @Setter
 public class PurchaseBackSelectDto extends BaseSelectDto {
 
+    /**
+     * 归属公司id
+     */
+    private Long companyId;
+
 }

+ 1 - 0
hx-sale/src/main/java/com/fjhx/sale/flow/PurchaseBackFlow.java

@@ -87,6 +87,7 @@ public class PurchaseBackFlow extends FlowDelegate {
     @Override
     public void end(Long flowId, Long businessId, JSONObject submitData) {
         PurchaseBack purchaseBack = purchaseBackService.getById(businessId);
+        purchaseBack.setCompanyId(SecurityUtils.getCompanyId());
         purchaseBack.setStatus(FlowStatusEnum1.PASS.getKey());
         purchaseBackService.updateById(purchaseBack);
 

+ 12 - 0
hx-sale/src/main/java/com/fjhx/sale/service/after/impl/AfterSalesServiceImpl.java

@@ -16,6 +16,7 @@ import com.fjhx.sale.entity.contract.po.ContractProduct;
 import com.fjhx.sale.mapper.after.AfterSalesMapper;
 import com.fjhx.sale.service.after.AfterSalesService;
 import com.fjhx.sale.service.contract.ContractProductService;
+import com.ruoyi.common.utils.SecurityUtils;
 import com.ruoyi.common.utils.wrapper.IWrapper;
 import com.ruoyi.common.utils.wrapper.SqlField;
 import com.ruoyi.system.utils.UserUtil;
@@ -23,6 +24,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.util.List;
+import java.util.Objects;
 
 
 /**
@@ -51,6 +53,14 @@ public class AfterSalesServiceImpl extends ServiceImpl<AfterSalesMapper, AfterSa
     public Page<AfterSalesVo> getPage(AfterSalesSelectDto dto) {
         IWrapper<AfterSales> wrapper = getWrapper();
 
+        //权限过滤:售后管理-子公司看自己的,总公司看全部
+        Long companyId = SecurityUtils.getCompanyId();
+        if (!Objects.equals(companyId, 100L)) {
+            wrapper.eq("as1", AfterSales::getCompanyId, companyId);
+        } else {
+            wrapper.eq("as1", AfterSales::getCompanyId, dto.getCompanyId());
+        }
+
         wrapper.keyword(dto.getKeyword(), new SqlField("as1.code"), new SqlField("c.code"));
 
         wrapper.orderByDesc("as1", AfterSales::getId);
@@ -94,6 +104,8 @@ public class AfterSalesServiceImpl extends ServiceImpl<AfterSalesMapper, AfterSa
         afterSalesDto.setContractId(contractProduct.getContractId());
         afterSalesDto.setProductId(contractProduct.getProductId());
 
+        afterSalesDto.setCompanyId(SecurityUtils.getCompanyId());
+
         this.save(afterSalesDto);
     }
 

+ 8 - 0
hx-sale/src/main/java/com/fjhx/sale/service/contract/impl/ContractServiceImpl.java

@@ -324,6 +324,14 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
      * @param wrapper
      */
     private void setContractParam(ContractSelectDto dto, IWrapper<Contract> wrapper) {
+        //权限过滤:销售合同-子公司看自己的,总公司看全部
+        Long companyId = SecurityUtils.getCompanyId();
+        if (!Objects.equals(companyId, 100L)) {
+            wrapper.eq("t1", Contract::getCompanyId, companyId);
+        } else {
+            wrapper.eq("t1", Contract::getCompanyId, dto.getCompanyId());
+        }
+
         wrapper.orderByDesc("t1", Contract::getCreateTime);
         if (StringUtils.isNotEmpty(dto.getStatus())) {
             wrapper.eq("t1", Contract::getStatus, dto.getStatus());

+ 10 - 0
hx-sale/src/main/java/com/fjhx/sale/service/purchase/impl/PurchaseBackServiceImpl.java

@@ -21,6 +21,7 @@ import com.fjhx.sale.service.purchase.PurchaseBackDetailsService;
 import com.fjhx.sale.service.purchase.PurchaseBackService;
 import com.fjhx.supply.entity.supplier.po.SupplierInfo;
 import com.fjhx.supply.service.supplier.SupplierInfoService;
+import com.ruoyi.common.utils.SecurityUtils;
 import com.ruoyi.common.utils.wrapper.IWrapper;
 import com.ruoyi.common.utils.wrapper.SqlField;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -29,6 +30,7 @@ import org.springframework.stereotype.Service;
 import java.math.BigDecimal;
 import java.util.List;
 import java.util.Map;
+import java.util.Objects;
 import java.util.stream.Collectors;
 
 
@@ -63,6 +65,14 @@ public class PurchaseBackServiceImpl extends ServiceImpl<PurchaseBackMapper, Pur
     public Page<PurchaseBackVo> getPage(PurchaseBackSelectDto dto) {
         IWrapper<PurchaseBack> wrapper = getWrapper();
 
+        //权限过滤:售后管理-子公司看自己的,总公司看全部
+        Long companyId = SecurityUtils.getCompanyId();
+        if (!Objects.equals(companyId, 100L)) {
+            wrapper.eq("pb", PurchaseBack::getCompanyId, companyId);
+        } else {
+            wrapper.eq("pb", PurchaseBack::getCompanyId, dto.getCompanyId());
+        }
+
         wrapper.keyword(dto.getKeyword(), new SqlField("pb.code"), new SqlField("p.code"));
 
         wrapper.orderByDesc("pb", PurchaseBack::getId);