李天标 3 年 前
コミット
fce61fa53f

+ 6 - 0
pom.xml

@@ -209,6 +209,12 @@
 			<artifactId>hmpay-sdk</artifactId>
 			<version>1.1.4</version>
 		</dependency>
+		<!-- 导出Excel -->
+		<dependency>
+			<groupId>cn.afterturn</groupId>
+			<artifactId>easypoi-base</artifactId>
+			<version>RELEASE</version>
+		</dependency>
 	</dependencies>
 
 	<build>

+ 102 - 0
src/main/java/com/szwl/controller/IndexController.java

@@ -28,6 +28,7 @@ import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.io.*;
 import java.math.BigDecimal;
+import java.text.SimpleDateFormat;
 import java.util.*;
 
 
@@ -49,6 +50,8 @@ public class IndexController { ;
     EsTEquipmentService esTEquipmentService;
     @Autowired
     TParametersService parametersService;
+    @Autowired
+    TPromoCodeService promoCodeService;
     @ApiOperation(value = "心跳")
     @PostMapping("/heart.htm")
     public JsonMessage heart(@RequestBody EquipmentVo equipmentVo) {
@@ -1298,5 +1301,104 @@ public class IndexController { ;
         }
         return JsonMessage.error("error");
     }
+
+    //修改优惠码状态
+    @RequestMapping(value = "/updateCode.htm", method = RequestMethod.GET)
+    @ResponseBody
+    public Object CardPay(String code, String clientId) {
+        LambdaQueryWrapper<TEquipment> query = Wrappers.lambdaQuery();
+        query.eq(TEquipment::getClientId,clientId);
+        List<TEquipment> list = equipmentService.list(query);
+        TEquipment equipment = list.get(0);
+//        List<Filter> filters = new ArrayList<>();
+//        if(code.length()<7){
+//            filters.add(Filter.in("adminId", equipment.getAdminId()));
+//        }
+//        filters.add(Filter.in("code", code));
+//        List<PromoCode> list = promoCodeService.findList(null, filters, null);
+//        PromoCode promoCode = list.get(0);
+        LambdaQueryWrapper<TPromoCode> query1 = Wrappers.lambdaQuery();
+        query1.eq(TPromoCode::getAdminId,equipment.getAdminId());
+        query1.eq(TPromoCode::getCode,code);
+        List<TPromoCode> list1 = promoCodeService.list(query1);
+        TPromoCode promoCode = list1.get(0);
+        promoCode.setIsUse("1");
+        promoCode.setUseBy(equipment.getName());
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        String time = sdf.format(new Date());
+        promoCode.setUseDate(time);
+        promoCodeService.updateById(promoCode);
+        return JsonMessage.success("success");
+    }
+    //验证优惠码
+    @RequestMapping(value = "/selectCode.htm", method = RequestMethod.GET)
+    @ResponseBody
+    public Object selectCode(String code, String clientId) {
+        LambdaQueryWrapper<TEquipment> query = Wrappers.lambdaQuery();
+        query.eq(TEquipment::getClientId,clientId);
+        List<TEquipment> list = equipmentService.list(query);
+        TEquipment equipment = list.get(0);
+
+        //验证优惠码
+        LambdaQueryWrapper<TPromoCode> query1 = Wrappers.lambdaQuery();
+        query1.eq(TPromoCode::getCode,code);
+        List<TPromoCode> codeList = promoCodeService.list(query1);
+        TPromoCode promoCode = new TPromoCode();
+        if (codeList.size() == 0) {
+            //不存在
+            return JsonMessage.success("1");
+        }
+        for (TPromoCode cod : codeList) {
+            if(!cod.getAdminId().equals("1")){
+                String adminId = cod.getAdminId();
+                String adminId1 = String.valueOf(equipment.getAdminId());
+                if (adminId.equals(adminId1)) {
+                    promoCode = cod;
+                }
+            }else{
+                promoCode = cod;
+            }
+        }
+        if(promoCode.getAdminId()==null){
+            //不是本机
+            return JsonMessage.success("3");
+        }
+        Date lastUseDate = null;
+        if (promoCode != null) {
+            lastUseDate = promoCode.getLastUseDate();
+        }
+
+        if (lastUseDate != null && lastUseDate.getTime() < ((new Date()).getTime())) {
+            promoCode.setIsUse("2");
+            promoCodeService.updateById(promoCode);
+            //过期
+            return JsonMessage.success("4");
+        }
+        if (promoCode.getId() == null) {
+            //不存在
+            return JsonMessage.success("1");
+        }
+        if (promoCode.getIsUse().equals("1")) {
+            //被使用
+            return JsonMessage.success("2");
+        }
+        if(!promoCode.getAdminId().equals("1")){
+            if (String.valueOf(equipment.getAdminId()).equals(promoCode.getAdminId())) {
+
+            } else {
+                //不是本机
+                return JsonMessage.success("3");
+            }
+        }
+        if (promoCode.getDiscount() == null) {
+            //旧优惠码
+            return JsonMessage.success("0");
+        }
+        if (promoCode.getDiscount() != null && promoCode.getDiscount() == 0) {
+            //0折
+            return JsonMessage.success("0");
+        }
+        return JsonMessage.success("success");
+    }
 }
 

+ 55 - 1
src/main/java/com/szwl/controller/TAdminController.java

@@ -26,6 +26,7 @@ import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.codec.digest.DigestUtils;
 import org.apache.commons.lang.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.repository.query.Param;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.bind.annotation.*;
 
@@ -59,7 +60,7 @@ public class TAdminController {
     @Autowired
     TMessageCodeService tMessageCodeService;
 
-    @ApiOperation(value = "添加账号")
+    @ApiOperation(value = "添加账号")
     @PostMapping("/addLoginUser")
     @Transactional
     @Audit(type = AuditEnum.INSERT,content = "#loginUser.name + '添加账号'")
@@ -114,6 +115,7 @@ public class TAdminController {
     @ApiOperation(value = "注册")
     @PostMapping("/save")
     @Transactional
+    @Audit(type = AuditEnum.INSERT,content = "#loginUser.name + '注册账号'")
     public ResponseModel<?> save(@RequestBody TAdmin admin) {
         if(StringUtils.isEmpty(admin.getUsername())||StringUtils.isEmpty(admin.getName())||StringUtils.isEmpty(admin.getPassword())){
             return R.fail(ResponseCodesEnum.A0100,"数据有空!");
@@ -171,11 +173,20 @@ public class TAdminController {
             admin.setIsEnabled(true);
             admin.setLoginFailureCount(0);
             admin.setIsLocked(false);
+            //默认是商家
+            admin.setType(2);
+            admin.setIsAdmined(true);
             admin.setPassword(DigestUtils.md5Hex(admin.getPassword()));
             boolean b = tAdminService.save(admin);
+            //todo 绑定商家角色
             tMessageCode.setModifyDate(new Date());
             tMessageCodeService.saveOrUpdate(tMessageCode);
+            if(b){
+                admin.setManagerId(admin.getManager());
+                tAdminService.getById(admin);
+            }
             return R.ok(b);
+
         }else {
             return R.fail(ResponseCodesEnum.A0002,"没有找到验证码");
         }
@@ -261,6 +272,14 @@ public class TAdminController {
         IPage<TAdmin> iPage = tAdminService.page(page, query);
         return R.ok(iPage);
     }
+    @ApiOperation(value = "获取账号列表 分页")
+    @GetMapping("/pageAdmin2")
+    public ResponseModel<IPage<TAdmin>> pageAdmin2(@RequestParam(value = "current") long current, @RequestParam(value = "size") long size ) {
+        LambdaQueryWrapper<TAdmin> query = Wrappers.lambdaQuery();
+        Page<TAdmin> page = new Page<>(current, size, true);
+        IPage<TAdmin> iPage = tAdminService.page(page, query);
+        return R.ok(iPage);
+    }
     @ApiOperation(value = "获取账号列表")
     @GetMapping("/listAdmin")
     public ResponseModel<?> listAdmin(String adminId ) {
@@ -316,6 +335,35 @@ public class TAdminController {
         return R.ok();
     }
 
+    @ApiOperation(value = "绑定上级账户")
+    @PostMapping("/setRelationAdmin")
+    @Transactional
+    public ResponseModel<?> setRelationAdmin(Long adminId,String username) {
+        TAdmin admin = tAdminService.getById(adminId);
+        if(StringUtils.isNotEmpty(username)){
+            if(StringUtils.isNotEmpty(admin.getRelationAdminId())){
+                return R.fail("已有绑定关系");
+            }
+            LambdaQueryWrapper<TAdmin> query = Wrappers.lambdaQuery();
+            query.eq(TAdmin::getUsername,username);
+            List<TAdmin> list = tAdminService.list(query);
+            if(list.size()>0){
+                TAdmin parentAdmin = list.get(0);
+                if(parentAdmin.getRelationAdminId().equals(admin.getId().toString())){
+                    return R.fail("不能互为绑定关系");
+                }else{
+                    admin.setRelationAdminId(String.valueOf(parentAdmin.getId()));
+                }
+            }else {
+                return R.fail("找不到账户");
+            }
+
+        }else {
+            return R.fail(ResponseCodesEnum.A0001);
+        }
+        return R.ok();
+    }
+
     @ApiOperation(value = "获取所有关联(下级)账号信息")
     @GetMapping("/getAdminIdList")
     public ResponseModel<List<Long>> getAdminIdList(String adminId) {
@@ -345,5 +393,11 @@ public class TAdminController {
         TAdmin tAdmin = list.get(0);
         return R.ok(tAdmin);
     }
+    @ApiOperation(value = "获取上级账号名")
+    @GetMapping("/getRelationAdminUsername")
+    public String getRelationAdminUsername(String relationAdminId) {
+        TAdmin admin = tAdminService.getById(relationAdminId);
+        return admin.getUsername();
+    }
 }
 

+ 65 - 1
src/main/java/com/szwl/controller/TEquipmentController.java

@@ -184,7 +184,7 @@ public class TEquipmentController {
         return R.ok(equipment);
     }
     //查找设备
-    @ApiOperation(value = "获取对应的机器编号")
+    @ApiOperation(value = "获取对应的机器id")
     @GetMapping("/getClientIdList")
     public ResponseModel<TAdminEquipment> getClientIdList(String  adminId) {
         //查找属于这个商家子账户的设备
@@ -193,6 +193,31 @@ public class TEquipmentController {
         return R.ok(adminEquipment);
     }
     //查找设备
+    @ApiOperation(value = "获取对应的机器编号")
+    @GetMapping("/getClientIds")
+    public ResponseModel<List<String>> getClientIds(String  adminId) {
+        //查找属于这个商家子账户的设备
+        TAdminEquipment adminEquipment = tAdminEquipmentService.getById(adminId);
+        String equipmentIds = adminEquipment.getEquipmentIds();
+        List<String> list = Collections.singletonList(equipmentIds);
+        List<String> returnList = new ArrayList<>();
+        if(list.size()>0){
+            for(String id:list){
+                TEquipment equipment = tEquipmentService.getById(id);
+                returnList.add(equipment.getClientId());
+            }
+        }
+        return R.ok(returnList);
+    }
+    @ApiOperation(value = "获取机器列表 分页")
+    @GetMapping("/pageEquipment2")
+    public ResponseModel<IPage<TEquipment>> pageEquipment2(@RequestParam(value = "current") long current, @RequestParam(value = "size") long size ) {
+        LambdaQueryWrapper<TEquipment> query = Wrappers.lambdaQuery();
+        Page<TEquipment> page = new Page<>(current, size, true);
+        IPage<TEquipment> iPage = tEquipmentService.page(page, query);
+        return R.ok(iPage);
+    }
+    //查找设备
     @ApiOperation(value = "adminId查找设备")
     @GetMapping("/listEquipment")
     public ResponseModel<?> listEquipment(String  adminId) {
@@ -220,6 +245,36 @@ public class TEquipmentController {
         List<TEquipment> list = tEquipmentService.list(query);
         return R.ok(list);
     }
+    @ApiOperation(value = "查找设备")
+    @PostMapping("/getEquipmentByNameAndId")
+    public ResponseModel<TEquipment> getEquipmentByNameAndId(@RequestBody TEquipment equipment) {
+        LambdaQueryWrapper<TEquipment> query = Wrappers.lambdaQuery();
+        TAdmin admin = tAdminService.getById(equipment.getId());
+        if(admin.getType()==3){
+            //子账户
+            TAdmin parentAdmin = tAdminService.getById(admin.getParentId());
+            LambdaQueryWrapper<TEquipment> query1 = Wrappers.lambdaQuery();
+            query1.eq(TEquipment::getAdminId,parentAdmin.getId());
+            List<TEquipment> list1 = tEquipmentService.list(query1);
+            if(list1.size()>0){
+                for(TEquipment tEquipment:list1){
+                    if(equipment.getName().equals(tEquipment.getName())){
+                        return R.ok(tEquipment);
+                    }
+                }
+            }
+        }
+        if(admin.getType()<2){
+            query.eq(TEquipment::getName,equipment.getName());
+        }
+        if(admin.getType()==2){
+            query.eq(TEquipment::getAdminId,equipment.getAdminId());
+            query.eq(TEquipment::getName,equipment.getName());
+        }
+        List<TEquipment> list = tEquipmentService.list(query);
+        TEquipment tEquipment = list.get(0);
+        return R.ok(tEquipment);
+    }
     /**
      * 更新
      */
@@ -329,6 +384,15 @@ public class TEquipmentController {
 
         return R.ok();
     }
+    @ApiOperation(value = "更新机器 整体")
+    @PostMapping("/updateByEquipment")
+    public ResponseModel<?> updateByEquipment(@RequestBody TEquipment equipment) {
+        if(equipment!=null&&equipment.getId()!=null){
+            equipment.setModifyDate(new Date());
+            tEquipmentService.updateById(equipment);
+        }
+        return R.ok();
+    }
     @ApiOperation(value = "查找机器")
     @PostMapping("/getEquipmentListByUser")
     public ResponseEntity<?> getEquipmentListByUser(@RequestBody TAdmin param) {

+ 92 - 13
src/main/java/com/szwl/controller/TOrderController.java

@@ -10,25 +10,16 @@ import com.szwl.feign.bean.PayFeign;
 import com.szwl.model.bo.JoinpayConstant;
 import com.szwl.model.bo.R;
 import com.szwl.model.bo.ResponseModel;
-import com.szwl.model.entity.TAdmin;
-import com.szwl.model.entity.TEquipment;
-import com.szwl.model.entity.TOrder;
-import com.szwl.model.entity.TShandeMch;
+import com.szwl.model.entity.*;
 import com.szwl.model.utils.Constant;
-import com.szwl.service.TAdminService;
-import com.szwl.service.TEquipmentService;
-import com.szwl.service.TOrderService;
-import com.szwl.service.TShandeMchService;
+import com.szwl.service.*;
 import com.szwl.service.es.EsTOrderService;
+import io.swagger.annotations.ApiOperation;
 import org.apache.commons.lang.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.HttpStatus;
 import org.springframework.http.ResponseEntity;
-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;
+import org.springframework.web.bind.annotation.*;
 
 import java.math.BigDecimal;
 import java.math.RoundingMode;
@@ -58,6 +49,10 @@ public class TOrderController {
     TShandeMchService tShandeMchService;
     @Autowired
     EsTOrderService esTOrderService;
+    @Autowired
+    TPriceService priceService;
+    @Autowired
+    TJoinpayMchService joinpayMchService;
     /**
      *  退款
      * @param
@@ -312,5 +307,89 @@ public class TOrderController {
                         .setData("申请退款已成功")
                         .setMessage("申请退款已成功"));
     }
+
+    @ApiOperation(value = "添加优惠码")
+    @GetMapping("/equipmentPay")
+        public ResponseModel<?> equipmentPay(Double number, Long equipmentId, String frpCode) {
+        TEquipment equipment = tEquipmentService.getById(equipmentId);
+        if (!frpCode.equals("ALIPAY_NATIVE") && !frpCode.equals("WEIXIN_NATIVE")) {
+            return R.fail("参数错误");
+        }
+        if (equipment == null) {
+            return R.fail("找不到设备");
+        }
+        TAdmin admin = tAdminService.getById(equipment.getAdminId());
+        Double money = null;
+        LambdaQueryWrapper<TPrice> query1 = Wrappers.lambdaQuery();
+        query1.eq(TPrice::getName,"MG280");
+        List<TPrice> prices = priceService.list(query1);
+        for(TPrice price:prices){
+            if(price.getName().equals("MG280")){
+                money = price.getPrice();
+            }
+        }
+        BigDecimal price = null;
+        double pri = money * number;
+        price = BigDecimal.valueOf(pri);
+
+        String sn = orderService.initSn(equipmentId);
+        String orderNo = sn;
+        String productName = "280充值";
+        BigDecimal cutPrice = price.multiply(new BigDecimal(100)).divide(new BigDecimal(100));
+        BigDecimal amount = cutPrice;
+        String productDesc = "";
+        String commonParameter = "";
+        String returnUrl = null;
+        String notifyUrl = JoinpayConstant.Notify_Url_PromoCode;
+        String isShowPic = "1";
+        String openId = null;
+        String authCode = null;
+        String appid = null;
+        String transactionModel = null;
+        String tradeMerchantNo = null;
+        String buyerId = null;
+        String isAlt = "0";
+        String altType = null;
+        String altUrl = null;
+        BigDecimal marketingAmount = null;
+//                frpCode = "WEIXIN_NATIVE";
+        TOrder order1 = new TOrder();
+        order1.setSn(sn);
+        order1.setType(0);
+        order1.setAdminId(admin.getId());
+        order1.setProductName(productName);
+        order1.setPrice(price);
+        order1.setEquipmentId(equipmentId);
+        order1.setClientId(equipment.getClientId());
+        order1.setStatus(0);
+        order1.setFrpCode(frpCode);
+        order1.setCreateDate(new Date());
+        order1.setModifyDate(new Date());
+        payFeign.addOrder(order1);
+        JSONArray altInfo = new JSONArray();
+        String result = null;
+        try {
+            result = joinpayMchService.uniPay(
+                    orderNo, amount, productName, productDesc,
+                    commonParameter, returnUrl, notifyUrl, frpCode,
+                    isShowPic, openId, authCode, appid, transactionModel, tradeMerchantNo,
+                    buyerId, isAlt, altType, altInfo, altUrl, marketingAmount
+            );
+        } catch (Exception e) {
+            e.printStackTrace();
+            return R.fail("申请支付失败");
+        }
+        JSONObject resultJson = JSONObject.parseObject(result);
+        // 汇聚支付支付申请返回支付二维码图片
+        String rd_Pic = resultJson.getString("rd_Pic");
+        if (resultJson == null || StringUtils.isBlank(rd_Pic)) {
+            return R.fail("找不到支付图片");
+        }
+        JSONObject kindData = new JSONObject();
+        kindData.put("sn", sn);
+        kindData.put("price", price);
+        kindData.put("image", rd_Pic);
+        return R.ok(kindData);
+    }
 }
 

+ 72 - 1
src/main/java/com/szwl/controller/TPromoCodeController.java

@@ -1,6 +1,8 @@
 package com.szwl.controller;
 
 
+import cn.afterturn.easypoi.excel.ExcelExportUtil;
+import cn.afterturn.easypoi.excel.entity.ExportParams;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@@ -9,13 +11,16 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.szwl.feign.bean.PayFeign;
 import com.szwl.model.bo.JoinpayConstant;
+import com.szwl.model.bo.JsonMessage;
 import com.szwl.model.bo.R;
 import com.szwl.model.bo.ResponseModel;
+import com.szwl.model.dto.PromoCodeTarget;
 import com.szwl.model.entity.*;
 import com.szwl.service.*;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.apache.commons.lang.StringUtils;
+import org.apache.poi.ss.usermodel.Workbook;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -23,8 +28,12 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.OutputStream;
 import java.io.UnsupportedEncodingException;
 import java.math.BigDecimal;
+import java.net.URLEncoder;
 import java.text.SimpleDateFormat;
 import java.util.*;
 
@@ -195,7 +204,7 @@ public class TPromoCodeController {
                 order1.setClientId(equipment.getClientId());
                 order1.setStatus(0);
                 order1.setFrpCode(frpCode);
-                order1.setRefundTrxNo(String.valueOf(month));
+//                order1.setRefundTrxNo(String.valueOf(month));
                 order1.setCreateDate(new Date());
                 order1.setModifyDate(new Date());
                 payFeign.addOrder(order1);
@@ -293,5 +302,67 @@ public class TPromoCodeController {
         IPage<TPromoCode> iPage = promoCodeService.page(page, query);
         return R.ok(iPage);
     }
+    @ApiOperation(value = "导出优惠码列表")
+    @GetMapping("/export")
+    public Object export(HttpServletResponse response, String adminId , String code, String isUse, Date useStratDate, Date useEndDate, Date createStratDate, Date createEndDate, long current, long size ) {
+        LambdaQueryWrapper<TPromoCode> query = Wrappers.lambdaQuery();
+        if(StringUtils.isNotEmpty(adminId)){
+            TAdmin admin = adminService.getById(adminId);
+            if(admin.getType()==0||admin.getType()==1){
+
+            }else {
+                query.eq(TPromoCode::getAdminId,adminId);
+            }
+        }else {
+            return R.fail(A0001);
+        }
+        if(StringUtils.isNotEmpty(code)){
+            query.eq(TPromoCode::getCode,code);
+        }
+        if(StringUtils.isNotEmpty(isUse)){
+            query.like(TPromoCode::getIsUse,isUse);
+        }
+        if(useStratDate!=null&&useEndDate!=null){
+            query.gt(TPromoCode::getUseDate,useStratDate);
+            query.lt(TPromoCode::getUseDate,useEndDate);
+        }
+        if(createStratDate!=null&&createEndDate!=null){
+            query.gt(TPromoCode::getCreateDate,createStratDate);
+            query.lt(TPromoCode::getCreateDate,createEndDate);
+        }
+
+        Page<TPromoCode> page = new Page<>(current, size, true);
+        IPage<TPromoCode> iPage = promoCodeService.page(page, query);
+        List<TPromoCode> list = iPage.getRecords();
+        List<PromoCodeTarget> promoCodeTargets = promoCodeService.findById(list);
+
+
+
+        ExportParams exportParams = new ExportParams("优惠码记录", "sheet1");
+        Workbook workbook = ExcelExportUtil.exportExcel(exportParams, PromoCodeTarget.class, promoCodeTargets);
+
+        if (workbook != null) {
+            OutputStream os = null;
+            try {
+                    os = response.getOutputStream();
+                SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmmss");
+                response.setContentType("application/vnd.ms-excel;charset=utf-8");
+                response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode("订单记录数据导出" + format.format(new Date()) + ".xls", "UTF-8"));
+                workbook.write(os);
+                return JsonMessage.success("导出成功");
+            } catch (Exception e) {
+                e.printStackTrace();
+                return JsonMessage.success("导出错误");
+            } finally {
+                try {
+                    os.close();
+                    workbook.close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
+        }
+        return JsonMessage.success("导出成功");
+    }
 }
 

+ 4 - 4
src/main/java/com/szwl/model/bo/JoinpayConstant.java

@@ -39,13 +39,13 @@ public class JoinpayConstant {
     /**
      *  支付成功回调
      */
-    public final static String Notify_Url = "http://app.sunzee.com.cn/api/order/notify.htm";
+    public final static String Notify_Url = "http://pay.sunzee.com.cn:49013/tOrder/notify.htm";
 //    public final static String Notify_Url = "http://slb.sunzee.com.cn/api/order/notify.htm";
 
-    public final static String mg280Notify_Url = "http://app.sunzee.com.cn/api/order/mg280Notify.htm";
+    public final static String mg280Notify_Url = "http://pay.sunzee.com.cn:49013/tOrder/mg280Notify.htm";
 //    public final static String mg280Notify_Url = "http://slb.sunzee.com.cn/api/order/mg280Notify.htm";
 
-    public final static String Notify_Url_PromoCode = "http://app.sunzee.com.cn/api/order/promoCodeNotify.htm";
+    public final static String Notify_Url_PromoCode = "http://pay.sunzee.com.cn:49013/tOrder/promoCodeNotify.htm";
 //    public final static String Notify_Url_PromoCode = "http://slb.sunzee.com.cn/api/order/promoCodeNotify.htm";
 
     public final static String Jiesuan_Url = "http://app.sunzee.com.cn/api/order/jiesuan.htm";
@@ -55,7 +55,7 @@ public class JoinpayConstant {
     /**
      *  退款成功回调
      */
-    public final static String Notify_Refund_Url = "http://app.sunzee.com.cn/api/order/notifyRefund.htm";
+    public final static String Notify_Refund_Url = "http://pay.sunzee.com.cn:49013/tOrder/notifyRefund.htm";
     public final static String Admin_Notify_Refund_Url = "http://app.sunzee.com.cn/api/order/adminNotifyRefund.htm";
 
 

+ 110 - 0
src/main/java/com/szwl/model/dto/PromoCodeTarget.java

@@ -0,0 +1,110 @@
+package com.szwl.model.dto;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+
+import java.util.Date;
+
+//订单导出
+public class PromoCodeTarget {
+
+    /**
+     * 优惠码
+     */
+    @Excel(name = "优惠码", width = 20.0D)
+    private Long code;
+
+    /**
+     * 商家id
+     */
+    @Excel(name = "商家id", width = 20.0D)
+    private String adminId;
+
+
+    /**
+     * 所属商家
+     */
+    @Excel(name = "所属商家", width = 20.0D)
+    private String userName;
+
+    /**
+     * 添加时间
+     */
+    @Excel(name = "添加时间", width = 20.0D)
+    private Date createDate;
+
+
+
+    /**
+     * 状态
+     */
+    @Excel(name = "状态", width = 20.0D)
+    private String isUse;
+
+    /**
+     * 使用时间
+     */
+    @Excel(name = "使用时间", width = 20.0D)
+    private String useDate;
+
+    /**
+     * 使用机器
+     */
+    @Excel(name = "使用机器", width = 20.0D)
+    private String useBy;
+
+    public Long getCode() {
+        return code;
+    }
+
+    public void setCode(Long code) {
+        this.code = code;
+    }
+
+    public String getAdminId() {
+        return adminId;
+    }
+
+    public void setAdminId(String adminId) {
+        this.adminId = adminId;
+    }
+
+    public String getUserName() {
+        return userName;
+    }
+
+    public void setUserName(String userName) {
+        this.userName = userName;
+    }
+
+    public Date getCreateDate() {
+        return createDate;
+    }
+
+    public void setCreateDate(Date createDate) {
+        this.createDate = createDate;
+    }
+
+    public String getIsUse() {
+        return isUse;
+    }
+
+    public void setIsUse(String isUse) {
+        this.isUse = isUse;
+    }
+
+    public String getUseDate() {
+        return useDate;
+    }
+
+    public void setUseDate(String useDate) {
+        this.useDate = useDate;
+    }
+
+    public String getUseBy() {
+        return useBy;
+    }
+
+    public void setUseBy(String useBy) {
+        this.useBy = useBy;
+    }
+}

+ 4 - 1
src/main/java/com/szwl/model/entity/TAdmin.java

@@ -108,8 +108,11 @@ public class TAdmin implements Serializable {
 
     @ApiModelProperty(value = "关联商家,相当于以前的parent_id")
     private String relationAdminId;
+
+    @ApiModelProperty(value = "系统id(设备申请连接系统时用);")
+    private String managerId;
     @Transient
-    public String getManagerId() {
+    public String getManager() {
 
         String managerId = "";
 

+ 4 - 0
src/main/java/com/szwl/service/TPromoCodeService.java

@@ -1,8 +1,11 @@
 package com.szwl.service;
 
+import com.szwl.model.dto.PromoCodeTarget;
 import com.szwl.model.entity.TPromoCode;
 import com.baomidou.mybatisplus.extension.service.IService;
 
+import java.util.List;
+
 /**
  * <p>
  * 优惠码列表 服务类
@@ -13,4 +16,5 @@ import com.baomidou.mybatisplus.extension.service.IService;
  */
 public interface TPromoCodeService extends IService<TPromoCode> {
 
+    List<PromoCodeTarget> findById(List<TPromoCode> list);
 }

+ 25 - 0
src/main/java/com/szwl/service/impl/TPromoCodeServiceImpl.java

@@ -1,11 +1,15 @@
 package com.szwl.service.impl;
 
+import com.szwl.model.dto.PromoCodeTarget;
 import com.szwl.model.entity.TPromoCode;
 import com.szwl.mapper.TPromoCodeMapper;
 import com.szwl.service.TPromoCodeService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.stereotype.Service;
 
+import java.util.ArrayList;
+import java.util.List;
+
 /**
  * <p>
  * 优惠码列表 服务实现类
@@ -17,4 +21,25 @@ import org.springframework.stereotype.Service;
 @Service
 public class TPromoCodeServiceImpl extends ServiceImpl<TPromoCodeMapper, TPromoCode> implements TPromoCodeService {
 
+    @Override
+    public List<PromoCodeTarget> findById(List<TPromoCode> list) {
+        List<PromoCodeTarget> promoCodeTargets = new ArrayList<>();
+        for(TPromoCode promoCode : list){
+            PromoCodeTarget promoCodeTarget = new PromoCodeTarget();
+            promoCodeTarget.setCode(promoCode.getCode());
+            promoCodeTarget.setAdminId(promoCode.getAdminId());
+            promoCodeTarget.setCreateDate(promoCode.getCreateDate());
+            if(promoCode.getIsUse().equals("0")){
+                promoCodeTarget.setIsUse("未使用");
+            }else {
+                promoCodeTarget.setIsUse("已使用");
+            }
+            promoCodeTarget.setUseBy(promoCode.getUseBy());
+            promoCodeTarget.setUseDate(promoCode.getUseDate());
+            promoCodeTarget.setUserName(promoCode.getUserName());
+            promoCodeTargets.add(promoCodeTarget);
+        }
+
+        return promoCodeTargets;
+    }
 }