Kaynağa Gözat

company:add优惠券

ct 3 hafta önce
ebeveyn
işleme
86c7cedea5

+ 7 - 1
fs-admin/src/main/java/com/fs/his/controller/FsStoreOrderController.java

@@ -604,7 +604,13 @@ public class FsStoreOrderController extends BaseController
             if (param.getUserPhoneMk() != null && !param.getUserPhoneMk().isEmpty()) {
                 param.setUserPhone(encryptPhone(param.getUserPhoneMk()));
             }
-            List<FsStoreOrderListVO> list = fsStoreOrderService.selectFsStoreOrderListVO(param);
+            List<FsStoreOrderListVO> list;
+            if (StringUtils.isNotBlank(param.getErpAccount())){
+                //金牛erp查询
+                list = fsStoreOrderService.selectFsStoreOrderListVOByErpAccount(param);
+            } else {
+                list = fsStoreOrderService.selectFsStoreOrderListVO(param);
+            }
             orderIds = list.stream().map(FsStoreOrderListVO::getOrderId).collect(Collectors.toList());
         }
         if (orderIds.isEmpty()){

+ 120 - 0
fs-company/src/main/java/com/fs/company/controller/store/FsCouponController.java

@@ -0,0 +1,120 @@
+package com.fs.company.controller.store;
+
+import com.fs.common.annotation.Log;
+import com.fs.common.core.controller.BaseController;
+import com.fs.common.core.domain.AjaxResult;
+import com.fs.common.core.domain.model.LoginUser;
+import com.fs.common.core.page.TableDataInfo;
+import com.fs.common.enums.BusinessType;
+import com.fs.common.exception.CustomException;
+import com.fs.common.utils.poi.ExcelUtil;
+import com.fs.his.domain.FsCoupon;
+import com.fs.his.param.FsCouponParam;
+import com.fs.his.service.IFsCouponService;
+import com.fs.his.vo.FsCouponAllListVO;
+import com.fs.his.vo.FsCouponListVO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+/**
+ * 优惠券Controller
+ *
+ * @author fs
+ * @date 2023-09-04
+ */
+@RestController
+@RequestMapping("/store/coupon")
+public class FsCouponController extends BaseController
+{
+    @Autowired
+    private IFsCouponService fsCouponService;
+
+    /**
+     * 查询优惠券列表订单查询
+     */
+    @PreAuthorize("@ss.hasPermi('store:coupon:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(FsCouponParam fsCoupon)
+    {
+        startPage();
+        List<FsCouponListVO> list = fsCouponService.selectFsCouponListVO(fsCoupon);
+        return getDataTable(list);
+    }
+
+    /**
+     * 查询优惠券列表订单查询
+     */
+    @GetMapping("/allList")
+    public AjaxResult allList()
+    {
+        List<FsCouponAllListVO> list = fsCouponService.selectFsCouponListAll();
+        return AjaxResult.success(list);
+    }
+
+
+
+    /**
+     * 导出优惠券列表
+     */
+    @PreAuthorize("@ss.hasPermi('store:coupon:export')")
+    @Log(title = "优惠券", businessType = BusinessType.EXPORT)
+    @GetMapping("/export")
+    public AjaxResult export(FsCoupon fsCoupon)
+    {
+        List<FsCoupon> list = fsCouponService.selectFsCouponList(fsCoupon);
+        ExcelUtil<FsCoupon> util = new ExcelUtil<FsCoupon>(FsCoupon.class);
+        return util.exportExcel(list, "优惠券数据");
+    }
+
+    /**
+     * 获取优惠券详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('store:coupon:query')")
+    @GetMapping(value = "/{couponId}")
+    public AjaxResult getInfo(@PathVariable("couponId") Long couponId)
+    {
+        return AjaxResult.success(fsCouponService.selectFsCouponByCouponId(couponId));
+    }
+
+//    /**
+//     * 新增优惠券
+//     */
+//    @PreAuthorize("@ss.hasPermi('store:coupon:add')")
+//    @Log(title = "优惠券", businessType = BusinessType.INSERT)
+//    @PostMapping
+//    public AjaxResult add(@RequestBody FsCoupon fsCoupon)
+//    {
+//        return toAjax(fsCouponService.insertFsCoupon(fsCoupon));
+//    }
+//
+//    /**
+//     * 修改优惠券
+//     */
+//    @PreAuthorize("@ss.hasPermi('store:coupon:edit')")
+//    @Log(title = "优惠券", businessType = BusinessType.UPDATE)
+//    @PutMapping
+//    public AjaxResult edit(@RequestBody FsCoupon fsCoupon)
+//    {
+//        FsCoupon c = fsCouponService.selectFsCouponByCouponId(fsCoupon.getCouponId());
+//        long l = c.getRemainNumber() + fsCoupon.getNumber() - c.getNumber();
+//        if (l<0){
+//            throw new CustomException("剩余卷不足");
+//        }
+//        fsCoupon.setRemainNumber(l);
+//        return toAjax(fsCouponService.updateFsCoupon(fsCoupon));
+//    }
+//
+//    /**
+//     * 删除优惠券
+//     */
+//    @PreAuthorize("@ss.hasPermi('store:coupon:remove')")
+//    @Log(title = "优惠券", businessType = BusinessType.DELETE)
+//	@DeleteMapping("/{couponIds}")
+//    public AjaxResult remove(@PathVariable Long[] couponIds)
+//    {
+//        return toAjax(fsCouponService.deleteFsCouponByCouponIds(couponIds));
+//    }
+}

+ 2 - 0
fs-company/src/main/java/com/fs/company/controller/store/FsUserCouponController.java

@@ -40,6 +40,8 @@ public class FsUserCouponController extends BaseController
     @GetMapping("/list")
     public TableDataInfo list(FsUserCouponParam fsUserCoupon)
     {
+        LoginUser loginUser = SecurityUtils.getLoginUser();
+        fsUserCoupon.setCompanyId(loginUser.getCompany().getCompanyId());
         startPage();
         List<FsUserCouponListVO> list = fsUserCouponService.selectFsUserCouponListVO(fsUserCoupon);
         return getDataTable(list);

+ 3 - 2
fs-service/src/main/java/com/fs/his/mapper/FsUserCouponMapper.java

@@ -81,8 +81,9 @@ public interface FsUserCouponMapper
             "            <if test=\"businessId != null \"> and uc.business_id = #{businessId}</if>\n" +
             "            <if test=\"businessType != null \"> and uc.business_type = #{businessType}</if>\n" +
             "            <if test=\"status != null \"> and uc.status = #{status}</if>\n" +
-            "            <if test=\"companyName != null \">and com.company_name like concat('%', #{companyName}, '%') </if>\n" +
-            "            <if test=\"companyUserName != null \">and comu.user_name like concat('%', #{companyUserName}, '%') </if>\n" +
+            "            <if test=\"companyName != null and companyName != ''\">and com.company_name like concat('%', #{companyName}, '%') </if>\n" +
+            "            <if test=\"companyUserName != null and companyUserName != ''\">and comu.user_name like concat('%', #{companyUserName}, '%') </if>\n" +
+            "            <if test=\"companyId != null \">and uc.company_id = #{companyId} </if>\n" +
             "        </where> "+
             " order by id desc"+
             "</script>"})

+ 2 - 0
fs-service/src/main/java/com/fs/his/param/FsUserCouponParam.java

@@ -55,4 +55,6 @@ public class FsUserCouponParam {
     private String companyName;
     private String companyUserName;
 
+    private Long companyId;
+
 }

+ 28 - 21
fs-service/src/main/java/com/fs/his/service/impl/FsStoreOrderServiceImpl.java

@@ -3402,28 +3402,35 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService {
         DFApiResponse dfApiResponse = JSON.parseObject(body, DFApiResponse.class);
         Object result = dfApiResponse.getResult();
         if (result != null) {
+
             String jsonString = JSON.toJSONString(result);
-            List<DFOrderStatusResultRequest> requestList = JSON.parseArray(jsonString, DFOrderStatusResultRequest.class);
-            if (requestList != null && !requestList.isEmpty()) {
-                //0待揽收 1已揽收 2运输中 3派送中 4异常件 5退回件 6退回签收 7转寄件 8作废件 9已签收 10 已取消
-                for (DFOrderStatusResultRequest temp : requestList) {
-                    if (temp.getStatus() == 10) {
-                        //取消订单
-                        String mailNumber = temp.getMailNumber();
-                        List<FsStoreOrder> fsStoreOrders = fsStoreOrderMapper.selectFsStoreOrderListByDeliverySn(mailNumber);
-                        if (fsStoreOrders != null && !fsStoreOrders.isEmpty()) {
-                            fsStoreOrders.forEach(order -> {
-                                FsStoreOrderSalesParam afterSalesParam = new FsStoreOrderSalesParam();
-                                afterSalesParam.setOrderId(order.getOrderId());
-                                afterSalesParam.setReasons("代服管家取消订单");
-                                afterSalesParam.setOperator("代服管家");
-                                afterSales(afterSalesParam);
-                                FsStoreOrderDf df = new FsStoreOrderDf();
-                                df.setOrderId(order.getOrderId());
-                                df.setStatus(2);
-                                df.setUpdateTime(new Date());
-                                fsStoreOrderDfMapper.updateFsStoreOrderDf(df);
-                            });
+            log.info("ct1111111111111111111{}", jsonString);
+            com.alibaba.fastjson.JSONObject jsonObject = JSON.parseObject(jsonString);
+            if (jsonObject != null) {
+                Object listObj = jsonObject.get("list");
+                String listJson = JSON.toJSONString(listObj);
+                List<DFOrderStatusResultRequest> requestList = JSON.parseArray(listJson, DFOrderStatusResultRequest.class);
+                if (requestList != null && !requestList.isEmpty()) {
+                    //0待揽收 1已揽收 2运输中 3派送中 4异常件 5退回件 6退回签收 7转寄件 8作废件 9已签收 10 已取消
+                    for (DFOrderStatusResultRequest temp : requestList) {
+                        if (temp.getStatus() == 10) {
+                            //取消订单
+                            String mailNumber = temp.getMailNumber();
+                            List<FsStoreOrder> fsStoreOrders = fsStoreOrderMapper.selectFsStoreOrderListByDeliverySn(mailNumber);
+                            if (fsStoreOrders != null && !fsStoreOrders.isEmpty()) {
+                                fsStoreOrders.forEach(order -> {
+                                    FsStoreOrderSalesParam afterSalesParam = new FsStoreOrderSalesParam();
+                                    afterSalesParam.setOrderId(order.getOrderId());
+                                    afterSalesParam.setReasons("代服管家取消订单");
+                                    afterSalesParam.setOperator("代服管家");
+                                    afterSales(afterSalesParam);
+                                    FsStoreOrderDf df = new FsStoreOrderDf();
+                                    df.setOrderId(order.getOrderId());
+                                    df.setStatus(2);
+                                    df.setUpdateTime(new Date());
+                                    fsStoreOrderDfMapper.updateFsStoreOrderDf(df);
+                                });
+                            }
                         }
                     }
                 }

+ 19 - 5
fs-user-app/src/main/java/com/fs/app/controller/CouponController.java

@@ -4,17 +4,17 @@ package com.fs.app.controller;
 import cn.hutool.Hutool;
 import cn.hutool.core.util.IdUtil;
 import com.fs.app.annotation.Login;
+import com.fs.common.annotation.Log;
+import com.fs.common.annotation.RepeatSubmit;
+import com.fs.common.core.domain.AjaxResult;
 import com.fs.common.core.domain.R;
 import com.fs.common.core.redis.RedisCache;
+import com.fs.common.enums.BusinessType;
 import com.fs.his.domain.FsCoupon;
-import com.fs.his.domain.FsPackage;
 import com.fs.his.param.*;
 import com.fs.his.service.IFsCouponService;
-import com.fs.his.service.IFsDoctorService;
-import com.fs.his.service.IFsPackageService;
+import com.fs.his.service.IFsUserCouponService;
 import com.fs.his.vo.FsCouponListUVO;
-import com.fs.his.vo.FsDoctorListUVO;
-import com.fs.his.vo.FsPackageListUVO;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import io.swagger.annotations.Api;
@@ -40,6 +40,9 @@ public class CouponController extends  AppBaseController {
     @Autowired
     private RedisCache redisCache;
 
+    @Autowired
+    private IFsUserCouponService fsUserCouponService;
+
     @ApiOperation("获取优惠券列表")
     @GetMapping("/getCouponList")
     public R getCouponList(FsCouponListUParam param)
@@ -84,5 +87,16 @@ public class CouponController extends  AppBaseController {
         return couponService.receive(param);
     }
 
+    /**
+     * 发送会员优惠券
+     */
+    @RepeatSubmit
+    @Log(title = "发送会员优惠券", businessType = BusinessType.INSERT)
+    @PostMapping("/sendCoupon")
+    public AjaxResult sendCoupon(@RequestBody FsUserCouponSendParam fsUserCoupon)
+    {
+        return toAjax(fsUserCouponService.sendFsUserCoupon(fsUserCoupon));
+    }
+
 
 }