qzy hai 3 semanas
pai
achega
a0d010a056
Modificáronse 17 ficheiros con 190 adicións e 150 borrados
  1. 1 1
      sp-service/level-one-server/src/main/java/com/pj/ht_trade_settlement/HtTradeSettlementService.java
  2. 9 0
      sp-service/level-one-server/src/main/java/com/pj/tb_import_order/TbImportOrder.java
  3. 2 1
      sp-service/level-one-server/src/main/java/com/pj/tb_import_order/TbImportOrderMapper.java
  4. 2 2
      sp-service/level-one-server/src/main/java/com/pj/tb_import_order/TbImportOrderMapper.xml
  5. 27 41
      sp-service/level-one-server/src/main/java/com/pj/tb_import_order/TbImportOrderService.java
  6. 1 0
      sp-service/level-one-server/src/main/java/com/pj/tb_order/TbOrder.java
  7. 4 1
      sp-service/level-one-server/src/main/java/com/pj/tb_order/TbOrderAppController.java
  8. 13 0
      sp-service/level-one-server/src/main/java/com/pj/tb_order/TbOrderController.java
  9. 16 5
      sp-service/level-one-server/src/main/java/com/pj/tb_order/TbOrderService.java
  10. 1 1
      sp-service/level-one-server/src/main/resources/logback.xml
  11. 28 8
      sp-service/level-two-server/src/main/java/com/pj/tb_orders/TbOrdersApiController.java
  12. 34 12
      sp-service/level-two-server/src/main/java/com/pj/tb_orders/TbOrdersController.java
  13. 2 0
      sp-service/level-two-server/src/main/java/com/pj/tb_orders/TbOrdersMapper.xml
  14. 29 1
      sp-service/level-two-server/src/main/java/com/pj/tb_orders/TbOrdersService.java
  15. 0 6
      sp-service/sp-admin/src/main/java/com/pj/project/app_user/AppUserApiController.java
  16. 11 50
      sp-service/sp-admin/src/main/java/com/pj/project/app_user/AppUserController.java
  17. 10 21
      sp-service/sp-admin/src/main/java/com/pj/project/app_user/AppUserService.java

+ 1 - 1
sp-service/level-one-server/src/main/java/com/pj/ht_trade_settlement/HtTradeSettlementService.java

@@ -160,7 +160,7 @@ public class HtTradeSettlementService extends ServiceImpl<HtTradeSettlementMappe
             tbOrder.setFinishStatus(OrderStatus.ORDER_STATUS_ZERO.getCode());
             //申报单类型,用以后续判断当前订单是否是委托单
             tbOrder.setDeclareType(tradeSettlementDto.getDeclareType());
-
+            tbOrder.setGoodsNames(tradeSettlementDto.getGoodsNames());
             //008进口申报单
             List<TbImportOrder> importOrderList = tbImportOrderService.lambdaQuery().eq(TbImportOrder::getPlatSeqNo, item.getPreIeportNo()).list();
             if (importOrderList.size() > 0) {

+ 9 - 0
sp-service/level-one-server/src/main/java/com/pj/tb_import_order/TbImportOrder.java

@@ -107,4 +107,13 @@ public class TbImportOrder extends Model<TbImportOrder> implements Serializable
 	private Date judgeTime;
 
 	private Date createTime;
+
+	private String gGrossWt;
+
+	private String gLimit;
+
+	private String goodsNames;
+
+	private String peopleIdNo;
+	private String peopleName;
 }

+ 2 - 1
sp-service/level-one-server/src/main/java/com/pj/tb_import_order/TbImportOrderMapper.java

@@ -6,6 +6,7 @@ import org.apache.ibatis.annotations.Mapper;
 
 import com.pj.utils.so.*;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
 import org.springframework.stereotype.Repository;
 
 /**
@@ -27,5 +28,5 @@ public interface TbImportOrderMapper extends BaseMapper <TbImportOrder> {
 	List<TbImportOrder> getList(SoMap so);
 
 
-    TbImportOrder findByManifestId(String manifestId);
+    TbImportOrder findByManifestId(@Param("manifestId") String manifestId,@Param("idCarNo") String idCarNo);
 }

+ 2 - 2
sp-service/level-one-server/src/main/java/com/pj/tb_import_order/TbImportOrderMapper.xml

@@ -32,7 +32,7 @@
 			<if test=' this.has("payStatus") '> and pay_status = #{payStatus} </if>
 			<if test=' this.has("platSeqNo") '> and plat_seq_no like concat('%',#{platSeqNo},'%') </if>
 			<if test=' this.has("veNo") '> and ve_no like concat('%',#{veNo},'%') </if>
-
+			<if test=' this.has("declareName") '> and declare_name = #{declareName} </if>
 			<if test=' this.has("createTime") '> and create_time = #{createTime} </if>
 			<if test=' this.has("createBy") '> and create_by = #{createBy} </if>
 			<if test=' this.has("createName") '> and create_name = #{createName} </if>
@@ -44,7 +44,7 @@
 		order by create_time desc,id desc
 	</select>
     <select id="findByManifestId" resultType="com.pj.tb_import_order.TbImportOrder">
-		select * from tb_import_order where manifest_id=#{manifestId}
+		select * from tb_import_order where manifest_id=#{manifestId} and people_id_no=#{idCarNo}
 	</select>
 
 </mapper>

+ 27 - 41
sp-service/level-one-server/src/main/java/com/pj/tb_import_order/TbImportOrderService.java

@@ -100,9 +100,6 @@ public class TbImportOrderService extends ServiceImpl<TbImportOrderMapper, TbImp
 
         ImportOrderVo importOrderVo = new ImportOrderVo();
         BeanUtils.copyProperties(importOrder, importOrderVo);
-
-        importOrderVo.setGoodsNames(peopleOrder.getGoodsNames());
-        importOrderVo.setGLimit(peopleOrder.getGLimit());
         return importOrderVo;
     }
 
@@ -118,43 +115,32 @@ public class TbImportOrderService extends ServiceImpl<TbImportOrderMapper, TbImp
      * 远程调用 进口申报单同步
      */
     public boolean importOrderDto(HtImportOrderDto importOrderDto) {
-        TbImportOrder importOrder = tbImportOrderMapper.findByManifestId(importOrderDto.getManifestId());
-        if (importOrder == null) {
-            importOrder = new TbImportOrder();
-            importOrder.setCreateTime(new Date());
-        }
-        BeanUtils.copyProperties(importOrderDto, importOrder, "id");
-        boolean save = saveOrUpdate(importOrder);
-        long importOrderId = importOrder.getId();
-        if (save) {
-            //委托边民额度
-            List<HtIeportDeclBillsBpLimitDto> ieportDeclBillsBpLimitDtoList = JSON.parseArray(importOrderDto.getBorderPeopleLimitList(), HtIeportDeclBillsBpLimitDto.class);
-            ieportDeclBillsBpLimitDtoList.forEach(ieportDeclBillsBpLimitDto -> {
-                LambdaUpdateWrapper<TbOrder> wrapper = new LambdaUpdateWrapper<>();
-                wrapper.set(TbOrder::getLimitNo, ieportDeclBillsBpLimitDto.getLimitNo());
-                wrapper.set(TbOrder::getGLimit, ieportDeclBillsBpLimitDto.getgLimit());
-                wrapper.set(TbOrder::getGNo, ieportDeclBillsBpLimitDto.getgNo());
-                wrapper.set(TbOrder::getImportOrderId, importOrderId);
-                wrapper.eq(TbOrder::getPreIeportNo, ieportDeclBillsBpLimitDto.getPlatSeqNo());
-                boolean update = tbOrderService.update(wrapper);
-            });
-            //申报单商品信息
-            List<HtIeportDeclBillsGoodsDto> ieportDeclBillsGoodsDtoList = JSON.parseArray(importOrderDto.getGoodsList(), HtIeportDeclBillsGoodsDto.class);
-            ieportDeclBillsGoodsDtoList.forEach(ieportDeclBillsGoodsDto -> {
-                TbImportGoods importGoods = importGoodsMapper.findBySeqPlatNo(ieportDeclBillsGoodsDto.getPlatSeqNo());
-                if (importGoods == null) {
-                    importGoods = new TbImportGoods();
-                }
-                BeanUtils.copyProperties(ieportDeclBillsGoodsDto, importGoods, "id");
-                importGoods.setImportOrderId(importOrderId);
-                if (importGoods.getId() != null) {
-                    importGoodsMapper.updateById(importGoods);
-                } else {
-                    importGoodsMapper.insert(importGoods);
-                }
-
-            });
-        }
-        return save;
+        //委托边民额度
+        List<HtIeportDeclBillsBpLimitDto> ieportDeclBillsBpLimitDtoList = JSON.parseArray(importOrderDto.getBorderPeopleLimitList(), HtIeportDeclBillsBpLimitDto.class);
+        ieportDeclBillsBpLimitDtoList.forEach(ieportDeclBillsBpLimitDto -> {
+            String peopleIdCardNo = ieportDeclBillsBpLimitDto.getCiphertextIdno();
+            TbImportOrder importOrder = tbImportOrderMapper.findByManifestId(importOrderDto.getManifestId(), peopleIdCardNo);
+            if (importOrder == null) {
+                importOrder = new TbImportOrder();
+                importOrder.setCreateTime(new Date());
+            }
+            BeanUtils.copyProperties(importOrderDto, importOrder, "id");
+            importOrder.setGoodsNames(ieportDeclBillsBpLimitDto.getgName())
+                    .setGLimit(ieportDeclBillsBpLimitDto.getgLimit())
+                    .setPeopleIdNo(peopleIdCardNo)
+                    .setPeopleName(ieportDeclBillsBpLimitDto.getBorderName())
+                    .setGGrossWt(ieportDeclBillsBpLimitDto.getgGrossWt());
+            saveOrUpdate(importOrder);
+            long importOrderId = importOrder.getId();
+            LambdaUpdateWrapper<TbOrder> wrapper = new LambdaUpdateWrapper<>();
+            wrapper.set(TbOrder::getLimitNo, ieportDeclBillsBpLimitDto.getLimitNo());
+            wrapper.set(TbOrder::getGLimit, ieportDeclBillsBpLimitDto.getgLimit());
+            wrapper.set(TbOrder::getGNo, ieportDeclBillsBpLimitDto.getgNo());
+            wrapper.set(TbOrder::getImportOrderId, importOrderId);
+            wrapper.eq(TbOrder::getPreIeportNo, ieportDeclBillsBpLimitDto.getPlatSeqNo());
+            wrapper.eq(TbOrder::getIdno, peopleIdCardNo);
+            tbOrderService.update(wrapper);
+        });
+        return true;
     }
 }

+ 1 - 0
sp-service/level-one-server/src/main/java/com/pj/tb_order/TbOrder.java

@@ -42,6 +42,7 @@ public class TbOrder extends Model<TbOrder> implements Serializable {
     public static final String PERMISSION_CODE_DEL = "tb-order-del";
     public static final String PERMISSION_CODE_EDIT_PRICE = "tb-order-edit-price";
 	public static final String PERMISSION_CODE_DEDUCTION = "tb-order-deduction";
+	public static final String PERMISSION_CODE_REFUND = "tb-order-refund";
 	public static final String PERMISSION_CODE_SEND009 = "tb-order-send009";
 	public static final String PERMISSION_CODE_SENDCXB001 = "tb-order-sendCXB001";
 

+ 4 - 1
sp-service/level-one-server/src/main/java/com/pj/tb_order/TbOrderAppController.java

@@ -191,6 +191,9 @@ public class TbOrderAppController {
 
 	@PostMapping("orderRefund")
     public AjaxJson orderRefund(@RequestParam("id")Long id) {
+		if (!StpAPPUserUtil.isLogin()){
+			return AjaxJson.getSuccess("请登录!");
+		}
         return AjaxJson.toAjax(tbOrderService.orderRefund(id));
     }
 
@@ -212,7 +215,7 @@ public class TbOrderAppController {
 
 	/** 收到银行退款回执 */
 	@PostMapping("rpc/chargebackFromBank")
-	public boolean chargebackFromBank(@RequestParam("tradeNo")String tradeNo, @RequestParam("SXB010Status")Integer SXB010Status, @RequestParam("note")String note) {
+	public boolean chargebackFromBank(@RequestParam("tradeNo")String tradeNo, @RequestParam("SXB023Status")Integer SXB010Status, @RequestParam("note")String note) {
 		boolean result = tbOrderService.chargebackFromBank(tradeNo, SXB010Status, note);
 		return result;
 	}

+ 13 - 0
sp-service/level-one-server/src/main/java/com/pj/tb_order/TbOrderController.java

@@ -7,9 +7,11 @@ import java.util.List;
 import java.util.Map;
 
 import cn.hutool.core.convert.Convert;
+import cn.hutool.core.util.RandomUtil;
 import com.pj.api.dto.HtDeclareChargebackDto;
 import com.pj.api.dto.HtPassCardDTO;
 import com.pj.api.dto.OrderDto;
+import com.pj.current.satoken.StpAPPUserUtil;
 import com.pj.utils.so.SoMap;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
@@ -119,6 +121,12 @@ public class TbOrderController {
         return AjaxJson.getSuccess();
     }
 
+    @RequestMapping("orderRefund")
+    @SaCheckPermission(TbOrder.PERMISSION_CODE_REFUND)
+    public AjaxJson orderRefund(@RequestParam("id")Long id) {
+        return AjaxJson.toAjax(tbOrderService.orderRefund(id));
+    }
+
     /**
      * 撤销转售
      */
@@ -237,4 +245,9 @@ public class TbOrderController {
         return tbOrderService.orderFinish(htPassCardDTO);
     }
 
+    public static void main(String[] args) {
+        System.out.println(RandomUtil.randomString(32));
+    }
+
+
 }

+ 16 - 5
sp-service/level-one-server/src/main/java/com/pj/tb_order/TbOrderService.java

@@ -556,8 +556,8 @@ public class TbOrderService extends ServiceImpl<TbOrderMapper, TbOrder> implemen
             tbOrder.setSxb010Status(1)
                     .setSxb010StatusTime(new Date());
             //如果已经过了卡三,则补发送一次通关报文给银行
-            if(tbOrder.getFinishStatus()==1){
-                HtTradeSettlement htTradeSettlement=htTradeSettlementService.getById(tbOrder.getSaleMainId());
+            if (tbOrder.getFinishStatus() == 1) {
+                HtTradeSettlement htTradeSettlement = htTradeSettlementService.getById(tbOrder.getSaleMainId());
                 //TODO: 2023/8/30 补发通关报文
                 PaymentDto paymentDto2 = new PaymentDto();
                 paymentDto2.setTradeNos(tradeNo);
@@ -720,11 +720,13 @@ public class TbOrderService extends ServiceImpl<TbOrderMapper, TbOrder> implemen
      */
     public boolean orderRefund(Long id) {
         TbOrder order = getById(id);
-        if (order.getPeopleConfirmStatus() != 1 || order.getSxb010Status() != 1 || order.getFinishStatus() == 1 || order.getRefundStatus() != 0)
-            throw new ServiceException("当前订单状态已改变,不可做退款操作,请刷新后操作!");
+        if (order.getPeopleConfirmStatus() != 1
+                || order.getSxb010Status() != 1
+                || order.getRefundStatus() != 0
+        )
+            throw new AjaxError("当前订单状态已改变,不可做退款操作,请刷新后操作!");
 
         PaymentDto paymentDto = this.getPaymentData(order);
-        StaticLog.info("\nsendSXB013(边民退货退款)——PaymentDto——:{}", JSONUtil.toJsonStr(paymentDto));
         paymentServerInterface.sendSXB013(paymentDto);
 
         LambdaUpdateWrapper<TbOrder> updateWrapper = new LambdaUpdateWrapper<>();
@@ -732,6 +734,7 @@ public class TbOrderService extends ServiceImpl<TbOrderMapper, TbOrder> implemen
         updateWrapper.set(TbOrder::getRefundTime, new Date());//退款时间
         updateWrapper.eq(TbOrder::getId, id);
         boolean update = this.update(updateWrapper);
+        StaticLog.info("\nsendSXB013(边民退货退款)——PaymentDto——:{},{}", update, JSONUtil.toJsonStr(paymentDto));
 
         return update;
     }
@@ -745,6 +748,14 @@ public class TbOrderService extends ServiceImpl<TbOrderMapper, TbOrder> implemen
             StaticLog.error("\n---------补扣款失败:{}不存在", id);
             return false;
         }
+        if (tbOrder.getSxb010Status() == 1) {
+            StaticLog.error("\n---------补扣款失败:{}不存在", id);
+            return false;
+        }
+        if (StrUtil.isEmpty(tbOrder.getGoodsNames())) {
+            StaticLog.error("\n---------无商品信息:{}", id);
+            return false;
+        }
 
         PaymentDto paymentDto = this.getPaymentData(tbOrder);
         StaticLog.info("\n---订单补扣款---sendSXB010——PaymentDto——:{}", JSONUtil.toJsonStr(paymentDto));

+ 1 - 1
sp-service/level-one-server/src/main/resources/logback.xml

@@ -2,7 +2,7 @@
 <configuration>
     <contextName>one</contextName>
     <property name="LOG_PATH" value="logs"/>
-    <property name="APP_DIR" value="pco"/>
+    <property name="APP_DIR" value="server"/>
     <property name="log.maxFileSize" value="10MB"/>
     <property name="log.maxFileCnt" value="90"/>
     <property name="log.totalSizeCap" value="10GB"/>

+ 28 - 8
sp-service/level-two-server/src/main/java/com/pj/tb_orders/TbOrdersApiController.java

@@ -11,13 +11,11 @@ import com.pj.tb_orders.vo.OrderStaticsDTO;
 import com.pj.utils.sg.AjaxJson;
 import com.pj.utils.so.SoMap;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Objects;
 import java.util.stream.Collectors;
 
 
@@ -79,7 +77,7 @@ public class TbOrdersApiController {
     @RequestMapping("purchaserBuyOneLevelOrder")
     public AjaxJson purchaserBuyOneLevelOrder() {
         List<Long> ids = SoMap.getRequestSoMap().getListByComma("ids", long.class);
-        List<TbOrders>  orders=  tbOrdersService.findByLevelOneOrderIds(ids);
+        List<TbOrders> orders = tbOrdersService.findByLevelOneOrderIds(ids);
         String orderIds = orders.stream().map(obj -> obj.getId() + "").collect(Collectors.joining(","));
         // 获取app登录用户
         APPLoginUserInfo appLoginInfo = StpAPPUserUtil.getAPPLoginInfo();
@@ -98,7 +96,7 @@ public class TbOrdersApiController {
         List<OrderDto> orderDtos = FeignFactory.levelOneServerInterface.getOrderListByMainIds(ids);
         List<Long> leveloneOrderIds = orderDtos.stream().map(OrderDto::getId).collect(Collectors.toList());
         List<TbOrders> orders = tbOrdersService.findByLevelOneOrderIds(leveloneOrderIds);
-        if (orders.isEmpty()){
+        if (orders.isEmpty()) {
             return AjaxJson.getError("订单不存在");
         }
         String orderIds = orders.stream().map(obj -> obj.getId() + "").collect(Collectors.joining(","));
@@ -125,9 +123,10 @@ public class TbOrdersApiController {
 
     /**
      * 获取在售订单
+     *
      * @return
      */
-  @RequestMapping("getOnSaleList")
+    @RequestMapping("getOnSaleList")
     public AjaxJson getOnSaleList() {
         SoMap so = SoMap.getRequestSoMap();
         List<TbOrders> list = tbOrdersService.getOnSaleList(so.startPage());
@@ -159,7 +158,7 @@ public class TbOrdersApiController {
     public AjaxJson getPurchaserStatistics() {
         SoMap so = SoMap.getRequestSoMap();
         APPLoginUserInfo appLoginInfo = StpAPPUserUtil.getAPPLoginInfo();
-        so.put("purchaserId",appLoginInfo.getFk());
+        so.put("purchaserId", appLoginInfo.getFk());
         List<OrderStaticsDTO> list = tbOrdersService.getPurchaserStatistics(so.startPage());
         return AjaxJson.getPageData(so.getDataCount(), list);
     }
@@ -234,6 +233,26 @@ public class TbOrdersApiController {
     }
 
 
+    @RequestMapping("deduction")
+    public AjaxJson deduction(Long id) {
+        if (!StpAPPUserUtil.isLogin()) {
+            return AjaxJson.getError("用户未登录");
+        }
+        TbOrders tbOrders = tbOrdersService.getById(id);
+        if (tbOrders == null) {
+            return AjaxJson.getError("订单不存在");
+        }
+        if (tbOrders.getIsPay() != 2) {
+            return AjaxJson.getError("订单无法执行补扣");
+        }
+        Long fkId = StpAPPUserUtil.getAPPLoginInfo().getFk();
+        if (!Objects.equals(fkId, tbOrders.getPurchaserId())) {
+            return AjaxJson.getError("您无权执行此操作");
+        }
+        tbOrdersService.deduction(id);
+        return AjaxJson.getSuccess();
+    }
+
     /**
      * 查 - 根据一级市场订单id查二级市场的转售金额
      */
@@ -246,6 +265,7 @@ public class TbOrdersApiController {
         return resalePrice;
     }
 
+
     /**
      * 采购商支付成功 ——> 边民缴税以及各服务费
      */

+ 34 - 12
sp-service/level-two-server/src/main/java/com/pj/tb_orders/TbOrdersController.java

@@ -2,6 +2,7 @@ package com.pj.tb_orders;
 
 import java.util.Date;
 import java.util.List;
+import java.util.stream.Collectors;
 
 import com.pj.api.consts.FeignFactory;
 import com.pj.api.dto.OrderDto;
@@ -41,17 +42,16 @@ public class TbOrdersController {
     TbOrdersService tbOrdersService;
 
 
-
     @RequestMapping("addOrderByResale")
     @SaCheckPermission(TbOrders.PERMISSION_CODE_EDIT_PRICE)
-    public AjaxJson addOrderByResale(Long id ) {
+    public AjaxJson addOrderByResale(Long id) {
         OrderDto orderDto = FeignFactory.levelOneServerInterface.getOrderDtoById(id);
         if (null == orderDto) throw new AjaxError("转售失败,请联系管理员!");
 
         //获取app登录用户
-        TbOrders db=tbOrdersService.findByLevelOneOrderId(id);
-        if (db!=null){
-            throw new AjaxError(orderDto.getTradeNo()+"已转售,请联系管理员处理");
+        TbOrders db = tbOrdersService.findByLevelOneOrderId(id);
+        if (db != null) {
+            throw new AjaxError(orderDto.getTradeNo() + "已转售,请联系管理员处理");
         }
         TbOrders orders = new TbOrders();
         orders.setResalePrice(orderDto.getUpPrice().doubleValue());
@@ -62,8 +62,8 @@ public class TbOrdersController {
         orders.setTradeAreaId(orderDto.getTradeAreaId());
         orders.setVeNo(orderDto.getVeNo())
                 .setGoodsUnit(orderDto.getGoodsUnit())
-                .setNetWet(orderDto.getNetWt()+"")
-                .setTotalWeight(orderDto.getTotalWeight()+"")
+                .setNetWet(orderDto.getNetWt() + "")
+                .setTotalWeight(orderDto.getTotalWeight() + "")
                 .setSinglePrice(orderDto.getDeclPrice().toString())
         ;
 
@@ -95,7 +95,6 @@ public class TbOrdersController {
     }
 
 
-
     @RequestMapping("addOrderByResaleBatch")
     @SaCheckPermission(TbOrders.PERMISSION_CODE_EDIT_PRICE)
     public AjaxJson addOrderByResaleBatch() {
@@ -186,15 +185,37 @@ public class TbOrdersController {
     }
 
 
-    /** 采购商补扣款 */
+    /**
+     * 采购商补扣款
+     */
     @RequestMapping("deduction")
     @SaCheckPermission(TbOrders.PERMISSION_CODE_DEDUCTION)
-    public AjaxJson deduction(Long id){
+    public AjaxJson deduction(Long id) {
         tbOrdersService.deduction(id);
         return AjaxJson.getSuccess();
     }
 
     /**
+     * 采购商补扣款
+     */
+    @RequestMapping("payBatch")
+    @SaCheckPermission(TbOrders.PERMISSION_CODE_DEDUCTION)
+    public AjaxJson payBatch() {
+        List<Long> ids = SoMap.getRequestSoMap().getListByComma("ids", long.class);
+        if (ids.isEmpty()) {
+            return AjaxJson.getError("请选择需要补扣款的订单!");
+        }
+        List<TbOrders> orders = tbOrdersService.listByIds(ids);
+        List<TbOrders> checkList = orders.stream().filter(tbOrders -> tbOrders.getIsPay() == 1 || tbOrders.getIsPay() == 3).collect(Collectors.toList());
+        if (!checkList.isEmpty()) {
+            return AjaxJson.getError("扣款订单中存在已支付或正在支付订单!");
+        }
+        tbOrdersService.payBatch(orders);
+
+        return AjaxJson.getSuccess();
+    }
+
+    /**
      * 查 - 交易凭证
      */
     @RequestMapping("getSubPrint")
@@ -218,14 +239,15 @@ public class TbOrdersController {
      * 根据一级市场订单删除二级市场订单
      */
     @RequestMapping("rpc/removeOnSaleOrderByLevelOneOrderId")
-    public boolean removeOnSaleOrderByLevelOneOrderId(@RequestParam("levelOneOrderId")Long levelOneOrderId) {
+    public boolean removeOnSaleOrderByLevelOneOrderId(@RequestParam("levelOneOrderId") Long levelOneOrderId) {
         return tbOrdersService.removeOnSaleOrderByLevelOneOrderId(levelOneOrderId);
     }
+
     /**
      * 根据一级市场订单删除二级市场订单
      */
     @RequestMapping("rpc/removeOnSaleOrderByLevelOneOrderIds")
-    public boolean removeOnSaleOrderByLevelOneOrderId(@RequestParam("levelOneOrderIds")String levelOneOrderIds) {
+    public boolean removeOnSaleOrderByLevelOneOrderId(@RequestParam("levelOneOrderIds") String levelOneOrderIds) {
         return tbOrdersService.removeOnSaleOrderByLevelOneOrderIds(levelOneOrderIds);
     }
 }

+ 2 - 0
sp-service/level-two-server/src/main/java/com/pj/tb_orders/TbOrdersMapper.xml

@@ -58,6 +58,8 @@
 			<if test=' this.has("isDelivery") '> and is_delivery = #{isDelivery} </if>
 			<if test=' this.has("isPay") '> and is_pay = #{isPay} </if>
 			<if test=' this.has("payTax") '> and pay_tax = #{payTax} </if>
+			<if test=' this.has("beOrder") and beOrder==1'> and purchaser_id is null </if>
+			<if test=' this.has("beOrder") and beOrder==2'> and purchaser_id is not null </if>
 			<if test=' this.has("dateBegin") '>and date_format(create_time,'%Y-%m-%d') &gt;=#{dateBegin}</if>
 			<if test=' this.has("dateEnd") '>and date_format(create_time,'%Y-%m-%d') &lt;=#{dateEnd}</if>
 		</where>

+ 29 - 1
sp-service/level-two-server/src/main/java/com/pj/tb_orders/TbOrdersService.java

@@ -678,8 +678,15 @@ public class TbOrdersService extends ServiceImpl<TbOrdersMapper, TbOrders> imple
             log.error("采购商补扣款失败:{}不存在", id);
             return false;
         }
-
+        if (tbOrders.getIsPay() == 1) {
+            log.error("订单已支付:{}", id);
+            return false;
+        }
         OrderDto orderOne = levelOneServerInterface.getOrderDtoById(tbOrders.getLevelOneOrderId());
+        if (StrUtil.isEmpty(orderOne.getGoodsNames())) {
+            log.error("采购商扣款失败:{} 订单未找到相关商品", tbOrders.getId());
+            return false;
+        }
         PaymentTwoDto paymentTwoDto = this.getPaymentData(tbOrders, orderOne);
         StaticLog.info("\n---采购商补扣款---sendMKT006_NoCommission——PaymentTwoDto——:{}", JSONUtil.toJsonStr(paymentTwoDto));
         paymentServerInterface.sendMKT006_NoCommission(paymentTwoDto);
@@ -776,4 +783,25 @@ public class TbOrdersService extends ServiceImpl<TbOrdersMapper, TbOrders> imple
 
         return tbOrdersMapper.delete(wrapper) == ids.size();
     }
+
+
+    public void payBatch(List<TbOrders> orders) {
+        for (TbOrders tbOrders : orders) {
+            OrderDto orderOne = levelOneServerInterface.getOrderDtoById(tbOrders.getLevelOneOrderId());
+            if (StrUtil.isEmpty(orderOne.getGoodsNames())) {
+                log.error("采购商扣款失败:{} 订单未找到相关商品", tbOrders.getId());
+                throw new AjaxError(tbOrders.getOrderNo() + "找不到商品信息");
+            }
+            PaymentTwoDto paymentTwoDto = this.getPaymentData(tbOrders, orderOne);
+            StaticLog.info("\n---采购商扣款---sendMKT006_NoCommission——PaymentTwoDto——:{}", JSONUtil.toJsonStr(paymentTwoDto));
+            paymentServerInterface.sendMKT006_NoCommission(paymentTwoDto);
+            if (tbOrders.getIsPay() == 2) {
+                tbOrders.setDeductionCount(tbOrders.getDeductionCount() + 1);
+                tbOrders.setDeductionTime(new Date());
+            }
+            tbOrders.setIsPay(3)
+                    .setPayTime(new Date());
+        }
+        this.updateBatchById(orders);
+    }
 }

+ 0 - 6
sp-service/sp-admin/src/main/java/com/pj/project/app_user/AppUserApiController.java

@@ -202,12 +202,6 @@ public class AppUserApiController {
      */
     @RequestMapping("delete")
     public AjaxJson delete(Long id){
-        AppUser appUser = new AppUser();
-        appUser.setId(id);
-        appUser.setDeleteStatus(DeleteStatus.DELETE_STATUS_OFF.getCode()); //被逻辑删除
-        appUser.setUpdateTime(new Date());
-        appUserService.update(appUser);
-
         return AjaxJson.getSuccess();
     }
 

+ 11 - 50
sp-service/sp-admin/src/main/java/com/pj/project/app_user/AppUserController.java

@@ -39,47 +39,10 @@ public class AppUserController {
     @Autowired
     AppUserService appUserService;
 
-    /**
-     * 增
-     */
-    @RequestMapping("add")
-    @SaCheckPermission(AppUser.PERMISSION_CODE_ADD)
-    public AjaxJson add(AppUser a) {
-        appUserService.add(a);
-        a = appUserService.getById(SP.publicMapper.getPrimarykey());
-        return AjaxJson.getSuccessData(a);
-    }
 
-    /**
-     * 删
-     */
-    @RequestMapping("delete")
-    @SaCheckPermission(AppUser.PERMISSION_CODE_DEL)
-    public AjaxJson delete(Long id) {
-        appUserService.delete(id);
-        return AjaxJson.getSuccess();
-    }
 
-    /**
-     * 删 - 根据id列表
-     */
-    @RequestMapping("deleteByIds")
-    @SaCheckPermission(AppUser.PERMISSION_CODE_DEL)
-    public AjaxJson deleteByIds() {
-        List<Long> ids = SoMap.getRequestSoMap().getListByComma("ids", long.class);
-        int line = SP.publicMapper.deleteByIds(AppUser.TABLE_NAME, ids);
-        return AjaxJson.getByLine(line);
-    }
 
-    /**
-     * 改
-     */
-    @RequestMapping("update")
-    @SaCheckPermission(AppUser.PERMISSION_CODE_EDIT)
-    public AjaxJson update(AppUser a) {
-        appUserService.update(a);
-        return AjaxJson.getSuccess();
-    }
+
 
     /**
      * 修改密码
@@ -90,6 +53,15 @@ public class AppUserController {
         StaticLog.info("dto:", JSONUtil.toJsonStr(dto.getPassword()));
         return AjaxJson.toAjax(appUserService.pass(dto));
     }
+    /**
+     * 修改密码
+     */
+    @RequestMapping("updateRole")
+    @SaCheckPermission(AppUser.PERMISSION_CODE_EDIT)
+    public AjaxJson updateRole(long id, String userType) {
+        int line = SP.publicMapper.updateColumnById("app_user", "user_type", userType, id);
+        return AjaxJson.getByLine(line);
+    }
 
     /**
      * 查 - 根据id
@@ -112,18 +84,7 @@ public class AppUserController {
         return AjaxJson.getPageData(so.getDataCount(), list);
     }
 
-    /**
-     * 更换角色
-     * <p>
-     * 当前用户已登录,app点击该按钮时,从缓存获取用户类型与选择要更换的角色id做对比,相同则进入此方法,故在此不做用户角色权限过滤
-     *
-     * @param appRoleId
-     * @return
-     */
-    @RequestMapping("updateRole")
-    AjaxJson updateRole(@RequestParam("appRoleId") String appRoleId) {
-        return appUserService.updateRole(appRoleId);
-    }
+
 
     @RequestMapping("cleanFace")
     public AjaxJson cleanFace(@RequestParam("id") Long id) {

+ 10 - 21
sp-service/sp-admin/src/main/java/com/pj/project/app_user/AppUserService.java

@@ -107,20 +107,6 @@ public class AppUserService extends ServiceImpl<AppUserMapper, AppUser> implemen
 
 
     /**
-     * 增
-     */
-    void add(AppUser t) {
-        save(t);
-    }
-
-    /**
-     * 删
-     */
-    void delete(Long id) {
-        removeById(id);
-    }
-
-    /**
      * 改
      */
     void update(AppUser a) {
@@ -648,7 +634,7 @@ public class AppUserService extends ServiceImpl<AppUserMapper, AppUser> implemen
     }
 
 
-    public void authFace(Long loginId, MultipartFile file, Integer type) throws IOException{
+    public void authFace(Long loginId, MultipartFile file, Integer type) throws IOException {
         String img;
         try (InputStream is = file.getInputStream()) {
             img = Base64.encode(is);
@@ -656,9 +642,9 @@ public class AppUserService extends ServiceImpl<AppUserMapper, AppUser> implemen
         } catch (IOException e) {
             throw new AjaxError("识别失败");
         }
-        byte[]images = ImageUtils.resizeByteImageBase64(img);
+        byte[] images = ImageUtils.resizeByteImageBase64(img);
         boolean hasPerson = faceFactory.handler().checkHasPerson(images);
-        if (!hasPerson){
+        if (!hasPerson) {
             throw new AjaxError("请正视摄像头");
         }
         if (type == 2) {
@@ -693,10 +679,10 @@ public class AppUserService extends ServiceImpl<AppUserMapper, AppUser> implemen
      * @param img
      * @param type
      */
-    public void authFace(Long loginId, String img, Integer type)throws IOException {
-        byte[]byteImageBase64 = ImageUtils.resizeByteImageBase64(img);
+    public void authFace(Long loginId, String img, Integer type) throws IOException {
+        byte[] byteImageBase64 = ImageUtils.resizeByteImageBase64(img);
         boolean hasPerson = faceFactory.handler().checkHasPerson(byteImageBase64);
-        if (!hasPerson){
+        if (!hasPerson) {
             throw new AjaxError("请正视摄像头");
         }
         if (type == 2) {
@@ -716,8 +702,11 @@ public class AppUserService extends ServiceImpl<AppUserMapper, AppUser> implemen
             }
             return;
         }
-        String faceId = RandomUtil.randomString(32);
         AppUser appUser = this.getById(loginId);
+        if (StrUtil.isNotEmpty(appUser.getFaceId()) && appUser.getFace() == 1) {
+            faceFactory.handler().deletePerson(appUser.getFaceId());
+        }
+        String faceId = RandomUtil.randomString(32);
         appUser.setFace(1);
         appUser.setFaceTime(new Date()).setFaceId(faceId);
         this.updateById(appUser);