diff --git a/electripper-admin/src/main/java/com/ruoyi/web/controller/app/AppController.java b/electripper-admin/src/main/java/com/ruoyi/web/controller/app/AppController.java index 38c06e2..ba4e616 100644 --- a/electripper-admin/src/main/java/com/ruoyi/web/controller/app/AppController.java +++ b/electripper-admin/src/main/java/com/ruoyi/web/controller/app/AppController.java @@ -1,20 +1,32 @@ package com.ruoyi.web.controller.app; +import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; +import com.alibaba.fastjson2.JSON; +import com.alibaba.fastjson2.JSONObject; +import com.aliyuncs.dysmsapi.model.v20170525.SendSmsResponse; +import com.aliyuncs.exceptions.ClientException; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.entity.AsArticleClassify; +import com.ruoyi.common.core.domain.entity.AsUser; +import com.ruoyi.common.core.domain.entity.SysDept; import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.exception.ServiceException; import com.ruoyi.common.utils.CommonUtil; +import com.ruoyi.common.utils.SendAliSmsUtil; +import com.ruoyi.common.utils.SendSmsVo; import com.ruoyi.common.utils.map.GeoUtils; import com.ruoyi.system.domain.*; +import com.ruoyi.system.mapper.AsUserMapper; import com.ruoyi.system.service.*; import com.wechat.pay.java.service.payments.model.Transaction; import com.wechat.pay.java.service.refund.model.Refund; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.web.bind.annotation.*; +import javax.annotation.Resource; import java.util.List; /** @@ -50,6 +62,21 @@ public class AppController extends BaseController @Autowired private IAsArticleClassifyService asArticleClassifyService; + @Resource + private AsUserMapper asUserMapper; + + @Value("${aliyun.accessKeyId}") + private String accessKeyId; + + @Value("${aliyun.accessKeySecret}") + private String accessKeySecret; + + @Value("${aliyun.signName}") + private String signName; + + @Value("${aliyun.templateCode}") + private String templateCode; + /** * 根据查询文章分类列表 @@ -398,5 +425,34 @@ public class AppController extends BaseController } return AjaxResult.success(); } + @GetMapping("/sendMsg") + public AjaxResult getUserInfo(String orderNo) + { + EtOrder order = etOrderService.selectEtOrderByOrderNo(orderNo); + /** 发送一个短信给运营商*/ + SysDept sysDept = wxPayService.getDeptObjByAreaId(order.getAreaId()); + logger.info("【微信支付回调】还车拍照审核,获取到运营商:【{}】", JSON.toJSON(sysDept)); + if(ObjectUtil.isNull(sysDept.getAppUserId())){ + throw new ServiceException("该运营商【"+sysDept.getDeptName()+"】未绑定微信用户"); + } + AsUser asUser1 = asUserMapper.selectUserById(sysDept.getAppUserId()); + JSONObject jsonObject = new JSONObject(); + jsonObject.put("name",order.getPayFee()); + String phone = asUser1.getPhonenumber(); + SendSmsVo sendSmsVo = new SendSmsVo(); + sendSmsVo.setMobile(phone); + sendSmsVo.setTemplateCode(templateCode); + sendSmsVo.setParam(jsonObject.toJSONString()); + sendSmsVo.setSignName(signName); + SendSmsResponse response = null; + logger.info("【微信支付回调】向阿里云发送短信,请求,----------【{}】", JSON.toJSONString(sendSmsVo)); + try { + response = SendAliSmsUtil.sendVerifyCode(accessKeyId,accessKeySecret,sendSmsVo); + } catch (ClientException e) { + e.printStackTrace(); + } + logger.info("【微信支付回调】发送阿里云短信成功,返回----------【{}】",JSON.toJSONString(response)); + return AjaxResult.success(); + } } diff --git a/electripper-admin/src/main/java/com/ruoyi/web/controller/app/AppVerifyController.java b/electripper-admin/src/main/java/com/ruoyi/web/controller/app/AppVerifyController.java index d5c59b5..d183a22 100644 --- a/electripper-admin/src/main/java/com/ruoyi/web/controller/app/AppVerifyController.java +++ b/electripper-admin/src/main/java/com/ruoyi/web/controller/app/AppVerifyController.java @@ -104,6 +104,9 @@ public class AppVerifyController extends BaseController @Autowired private IEtWithdrawService etWithdrawService; + @Autowired + private IWxPayService wxPayService; + /** * 故障上报 @@ -879,26 +882,13 @@ public class AppVerifyController extends BaseController } /** - * 根据token获取运营商信息 + * 获取运营商信息 */ @GetMapping("/getDept") - public AjaxResult getDept() + public AjaxResult getDept(Long areaId) { - AsUser asUser = getLoginUser().getAsUser(); - AsUser asUser1 = asUserService.selectUserById(asUser.getUserId()); - logger.info("获取到当前app登录用户:【{}】", JSON.toJSON(asUser1)); - if(ObjectUtil.isNull(asUser1.getSysUserId())){ - throw new RuntimeException("用户【"+asUser1.getUserName()+"】未绑定系统用户"); - } - SysUser sysUser = userService.selectUserById(asUser1.getSysUserId()); - Long deptId; - SysDept sysDept = null; - if(!sysUser.isAdmin()){ - deptId = sysUser.getDeptId(); - sysDept = deptService.selectDeptById(deptId); - logger.info("根据token获取运营商信息:【{}】", JSON.toJSON(sysDept)); - return success(sysDept); - } + logger.info("【获取运营商信息】获取到areaId:【{}】", areaId); + SysDept sysDept = wxPayService.getDeptObjByAreaId(areaId); return success(sysDept); } diff --git a/electripper-admin/src/main/java/com/ruoyi/web/controller/system/EtMsgLogController.java b/electripper-admin/src/main/java/com/ruoyi/web/controller/system/EtMsgLogController.java new file mode 100644 index 0000000..41b12ad --- /dev/null +++ b/electripper-admin/src/main/java/com/ruoyi/web/controller/system/EtMsgLogController.java @@ -0,0 +1,104 @@ +package com.ruoyi.web.controller.system; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.system.domain.EtMsgLog; +import com.ruoyi.system.service.IEtMsgLogService; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.common.core.page.TableDataInfo; + +/** + * 短信日志Controller + * + * @author qiuzhenzhen + * @date 2024-07-24 + */ +@RestController +@RequestMapping("/system/msgLog") +public class EtMsgLogController extends BaseController +{ + @Autowired + private IEtMsgLogService etMsgLogService; + + /** + * 查询短信日志列表 + */ + @PreAuthorize("@ss.hasPermi('system:msgLog:list')") + @GetMapping("/list") + public TableDataInfo list(EtMsgLog etMsgLog) + { + startPage(); + List list = etMsgLogService.selectEtMsgLogList(etMsgLog); + return getDataTable(list); + } + + /** + * 导出短信日志列表 + */ + @PreAuthorize("@ss.hasPermi('system:msgLog:export')") + @Log(title = "短信日志", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, EtMsgLog etMsgLog) + { + List list = etMsgLogService.selectEtMsgLogList(etMsgLog); + ExcelUtil util = new ExcelUtil(EtMsgLog.class); + util.exportExcel(response, list, "短信日志数据"); + } + + /** + * 获取短信日志详细信息 + */ + @PreAuthorize("@ss.hasPermi('system:msgLog:query')") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) + { + return success(etMsgLogService.selectEtMsgLogById(id)); + } + + /** + * 新增短信日志 + */ + @PreAuthorize("@ss.hasPermi('system:msgLog:add')") + @Log(title = "短信日志", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody EtMsgLog etMsgLog) + { + return toAjax(etMsgLogService.insertEtMsgLog(etMsgLog)); + } + + /** + * 修改短信日志 + */ + @PreAuthorize("@ss.hasPermi('system:msgLog:edit')") + @Log(title = "短信日志", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody EtMsgLog etMsgLog) + { + return toAjax(etMsgLogService.updateEtMsgLog(etMsgLog)); + } + + /** + * 删除短信日志 + */ + @PreAuthorize("@ss.hasPermi('system:msgLog:remove')") + @Log(title = "短信日志", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) + { + return toAjax(etMsgLogService.deleteEtMsgLogByIds(ids)); + } +} diff --git a/electripper-admin/src/main/resources/application.yml b/electripper-admin/src/main/resources/application.yml index 93bb0c9..146cc56 100644 --- a/electripper-admin/src/main/resources/application.yml +++ b/electripper-admin/src/main/resources/application.yml @@ -142,7 +142,7 @@ aliyun: accessKeySecret: eQJsruUAvFfJblHZJ50QyiALCSZeRK signName: 创享电动车 # 验证码模版id - templateCode: SMS_465344261 + templateCode: SMS_470225045 # 七牛云配置 qiniu: # 七牛云key diff --git a/electripper-common/src/main/java/com/ruoyi/common/constant/ServiceConstants.java b/electripper-common/src/main/java/com/ruoyi/common/constant/ServiceConstants.java index 33149f7..f0f3023 100644 --- a/electripper-common/src/main/java/com/ruoyi/common/constant/ServiceConstants.java +++ b/electripper-common/src/main/java/com/ruoyi/common/constant/ServiceConstants.java @@ -45,6 +45,11 @@ public class ServiceConstants { */ public static final String ORDER_TYPE_VEHICLE_DAMAGE = "7"; + /** + * 订单类型: 8-短信扣费 + */ + public static final String ORDER_TYPE_MSG = "8"; + /**----------------------------订单类型end----------------------------*/ /**----------------------------支付场景start----------------------------*/ /** 支付场景: 1-骑行支付,2-取消预约支付,3-套餐支付,4-押金支付 */ @@ -145,6 +150,11 @@ public class ServiceConstants { */ public static final String PAY_TYPE_YJ = "yj"; + /** + * 支付方式: ye-余额抵扣 + */ + public static final String PAY_TYPE_YE = "yj"; + /**----------------------------支付类型end----------------------------*/ /**----------------------------车辆状态start----------------------------*/ diff --git a/electripper-system/src/main/java/com/ruoyi/system/domain/EtFeeRule.java b/electripper-system/src/main/java/com/ruoyi/system/domain/EtFeeRule.java index a4ad237..dd9bc23 100644 --- a/electripper-system/src/main/java/com/ruoyi/system/domain/EtFeeRule.java +++ b/electripper-system/src/main/java/com/ruoyi/system/domain/EtFeeRule.java @@ -34,6 +34,11 @@ public class EtFeeRule extends BaseEntity @TableField(exist = false) private EtOperatingArea area; + /** 运营区名称 */ + @Excel(name = "运营区名称") + @TableField(exist = false) + private String areaName; + /** 运营商 */ @Excel(name = "运营商") private String deptName; diff --git a/electripper-system/src/main/java/com/ruoyi/system/domain/EtMsgLog.java b/electripper-system/src/main/java/com/ruoyi/system/domain/EtMsgLog.java new file mode 100644 index 0000000..00404cb --- /dev/null +++ b/electripper-system/src/main/java/com/ruoyi/system/domain/EtMsgLog.java @@ -0,0 +1,40 @@ +package com.ruoyi.system.domain; + +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.core.domain.BaseEntity; +import lombok.Data; + +/** + * 短信日志对象 et_msg_log + * + * @author qiuzhenzhen + * @date 2024-07-24 + */ +@Data +public class EtMsgLog extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 主键 */ + private Long id; + + /** 短信类型 */ + @Excel(name = "短信类型") + private String type; + + /** 模版code */ + private String templateCode; + + /** 短信签名 */ + @Excel(name = "短信签名") + private String signName; + + /** 内容 */ + @Excel(name = "内容") + private String content; + + /** 发送手机号 */ + @Excel(name = "发送手机号") + private String phone; + +} diff --git a/electripper-system/src/main/java/com/ruoyi/system/mapper/AsDeviceMapper.java b/electripper-system/src/main/java/com/ruoyi/system/mapper/AsDeviceMapper.java index a947de3..c70ac27 100644 --- a/electripper-system/src/main/java/com/ruoyi/system/mapper/AsDeviceMapper.java +++ b/electripper-system/src/main/java/com/ruoyi/system/mapper/AsDeviceMapper.java @@ -119,6 +119,14 @@ public interface AsDeviceMapper extends BaseMapper */ public int oneClickOffline(Long[] deviceIds); + /** + * 一键入仓 + * + * @param deviceIds 需要一键入仓的设备主键集合 + * @return 结果 + */ + public int oneClickWarehousing(Long[] deviceIds); + /** * 有订单车辆 diff --git a/electripper-system/src/main/java/com/ruoyi/system/mapper/EtAreaRuleMapper.java b/electripper-system/src/main/java/com/ruoyi/system/mapper/EtAreaRuleMapper.java index 60f11a2..e6758b6 100644 --- a/electripper-system/src/main/java/com/ruoyi/system/mapper/EtAreaRuleMapper.java +++ b/electripper-system/src/main/java/com/ruoyi/system/mapper/EtAreaRuleMapper.java @@ -17,4 +17,13 @@ public interface EtAreaRuleMapper extends BaseMapper * @return 结果 */ public int deleteAreaRuleByAreaId(Long areaId); + + /** + * 通过用ruleId删除区域与收费方式关联 + * + * @param ruleId 运营区id + * @return 结果 + */ + public int deleteAreaRuleByRuleId(Long ruleId); + } diff --git a/electripper-system/src/main/java/com/ruoyi/system/mapper/EtMsgLogMapper.java b/electripper-system/src/main/java/com/ruoyi/system/mapper/EtMsgLogMapper.java new file mode 100644 index 0000000..a6de65a --- /dev/null +++ b/electripper-system/src/main/java/com/ruoyi/system/mapper/EtMsgLogMapper.java @@ -0,0 +1,61 @@ +package com.ruoyi.system.mapper; + +import java.util.List; +import com.ruoyi.system.domain.EtMsgLog; + +/** + * 短信日志Mapper接口 + * + * @author qiuzhenzhen + * @date 2024-07-24 + */ +public interface EtMsgLogMapper +{ + /** + * 查询短信日志 + * + * @param id 短信日志主键 + * @return 短信日志 + */ + public EtMsgLog selectEtMsgLogById(Long id); + + /** + * 查询短信日志列表 + * + * @param etMsgLog 短信日志 + * @return 短信日志集合 + */ + public List selectEtMsgLogList(EtMsgLog etMsgLog); + + /** + * 新增短信日志 + * + * @param etMsgLog 短信日志 + * @return 结果 + */ + public int insertEtMsgLog(EtMsgLog etMsgLog); + + /** + * 修改短信日志 + * + * @param etMsgLog 短信日志 + * @return 结果 + */ + public int updateEtMsgLog(EtMsgLog etMsgLog); + + /** + * 删除短信日志 + * + * @param id 短信日志主键 + * @return 结果 + */ + public int deleteEtMsgLogById(Long id); + + /** + * 批量删除短信日志 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteEtMsgLogByIds(Long[] ids); +} diff --git a/electripper-system/src/main/java/com/ruoyi/system/service/IEtMsgLogService.java b/electripper-system/src/main/java/com/ruoyi/system/service/IEtMsgLogService.java new file mode 100644 index 0000000..a2601a6 --- /dev/null +++ b/electripper-system/src/main/java/com/ruoyi/system/service/IEtMsgLogService.java @@ -0,0 +1,61 @@ +package com.ruoyi.system.service; + +import java.util.List; +import com.ruoyi.system.domain.EtMsgLog; + +/** + * 短信日志Service接口 + * + * @author qiuzhenzhen + * @date 2024-07-24 + */ +public interface IEtMsgLogService +{ + /** + * 查询短信日志 + * + * @param id 短信日志主键 + * @return 短信日志 + */ + public EtMsgLog selectEtMsgLogById(Long id); + + /** + * 查询短信日志列表 + * + * @param etMsgLog 短信日志 + * @return 短信日志集合 + */ + public List selectEtMsgLogList(EtMsgLog etMsgLog); + + /** + * 新增短信日志 + * + * @param etMsgLog 短信日志 + * @return 结果 + */ + public int insertEtMsgLog(EtMsgLog etMsgLog); + + /** + * 修改短信日志 + * + * @param etMsgLog 短信日志 + * @return 结果 + */ + public int updateEtMsgLog(EtMsgLog etMsgLog); + + /** + * 批量删除短信日志 + * + * @param ids 需要删除的短信日志主键集合 + * @return 结果 + */ + public int deleteEtMsgLogByIds(Long[] ids); + + /** + * 删除短信日志信息 + * + * @param id 短信日志主键 + * @return 结果 + */ + public int deleteEtMsgLogById(Long id); +} diff --git a/electripper-system/src/main/java/com/ruoyi/system/service/impl/AsDeviceServiceImpl.java b/electripper-system/src/main/java/com/ruoyi/system/service/impl/AsDeviceServiceImpl.java index d7d5877..1c3f243 100644 --- a/electripper-system/src/main/java/com/ruoyi/system/service/impl/AsDeviceServiceImpl.java +++ b/electripper-system/src/main/java/com/ruoyi/system/service/impl/AsDeviceServiceImpl.java @@ -471,7 +471,7 @@ public class AsDeviceServiceImpl extends ServiceImpl i throw new ServiceException("车辆【"+device.getSn()+"】为‘废弃’状态不能入仓"); } } - return asDeviceMapper.oneClickOffline(deviceIds); + return asDeviceMapper.oneClickWarehousing(deviceIds); } /** diff --git a/electripper-system/src/main/java/com/ruoyi/system/service/impl/CallbackServiceImpl.java b/electripper-system/src/main/java/com/ruoyi/system/service/impl/CallbackServiceImpl.java index 7e7b2cd..182baa2 100644 --- a/electripper-system/src/main/java/com/ruoyi/system/service/impl/CallbackServiceImpl.java +++ b/electripper-system/src/main/java/com/ruoyi/system/service/impl/CallbackServiceImpl.java @@ -136,6 +136,9 @@ public class CallbackServiceImpl implements CallbackService { @Value("${aliyun.templateCode}") private String templateCode; + @Resource + private EtMsgLogMapper etMsgLogMapper; + // @Value("${et.handlingCharge}") // private String handlingCharge; @@ -197,31 +200,11 @@ public class CallbackServiceImpl implements CallbackService { logger.info("【微信支付回调】还车-----需要-----拍照审核"); order.setStatus(ServiceConstants.ORDER_STATUS_TO_BE_AUDIT);//如果还车需要拍照审核,状态为待审核 BigDecimal amount = order.getPayFee(); - // 异步处理 - scheduledExecutorService.schedule(() -> { - /** 发送一个短信给运营商*/ - SysDept sysDept = wxPayService.getDeptObjByAreaId(order.getAreaId()); - logger.info("【微信支付回调】还车拍照审核,获取到运营商:【{}】",JSON.toJSON(sysDept)); - AsUser asUser1 = asUserMapper.selectUserById(sysDept.getAppUserId()); - JSONObject jsonObject = new JSONObject(); - jsonObject.put("amount",amount); - - String phone = asUser1.getPhonenumber(); - SendSmsVo sendSmsVo = new SendSmsVo(); - sendSmsVo.setMobile(phone); - sendSmsVo.setTemplateCode(templateCode); - sendSmsVo.setParam(jsonObject.toJSONString()); - sendSmsVo.setSignName(signName); - SendSmsResponse response = null; - logger.info("【微信支付回调】向阿里云发送短信,请求,----------【{}】", JSON.toJSONString(sendSmsVo)); - try { - response = SendAliSmsUtil.sendVerifyCode(accessKeyId,accessKeySecret,sendSmsVo); - } catch (ClientException e) { - e.printStackTrace(); - } - logger.info("【微信支付回调】发送阿里云短信成功,返回----------【{}】",JSON.toJSONString(response)); - }, 0 , TimeUnit.HOURS); + // 异步处理短信 + if("1".equals(area.getMsgSwitch())){ + asynchronousMsg(order, amount); + } }else{ logger.info("【微信支付回调】还车-----不需要-----拍照审核"); order.setStatus(ServiceConstants.ORDER_STATUS_ORDER_END); @@ -294,6 +277,54 @@ public class CallbackServiceImpl implements CallbackService { } } + private void asynchronousMsg(EtOrder order, BigDecimal amount) { + scheduledExecutorService.schedule(() -> { + /** 发送一个短信给运营商*/ + SysDept sysDept = wxPayService.getDeptObjByAreaId(order.getAreaId()); + logger.info("【微信支付回调】还车拍照审核,获取到运营商:【{}】",JSON.toJSON(sysDept)); + if(ObjectUtil.isNull(sysDept.getAppUserId())){ + throw new ServiceException("该运营商【"+sysDept.getDeptName()+"】未绑定微信用户"); + } + AsUser asUser1 = asUserMapper.selectUserById(sysDept.getAppUserId()); + + JSONObject jsonObject = new JSONObject(); + jsonObject.put("name", amount); + + String phone = asUser1.getPhonenumber(); + SendSmsVo sendSmsVo = new SendSmsVo(); + sendSmsVo.setMobile(phone); + sendSmsVo.setTemplateCode(templateCode); + sendSmsVo.setParam(jsonObject.toJSONString()); + sendSmsVo.setSignName(signName); + SendSmsResponse response = null; + logger.info("【微信支付回调】向阿里云发送短信,请求,----------【{}】", JSON.toJSONString(sendSmsVo)); + try { + response = SendAliSmsUtil.sendVerifyCode(accessKeyId,accessKeySecret,sendSmsVo); + } catch (ClientException e) { + e.printStackTrace(); + } + logger.info("【微信支付回调】发送阿里云短信成功,返回----------【{}】",JSON.toJSONString(response)); + //记录资金流水 + order.setPayFee(new BigDecimal(0.1)); + callbackService.capitalFlowRecords(order,ServiceConstants.FLOW_TYPE_DISBURSE, + ServiceConstants.ORDER_TYPE_MSG,ServiceConstants.OWNER_TYPE_OPERATOR,null,ServiceConstants.PAY_TYPE_YE); + + // 短信日志 + EtMsgLog etMsgLog = new EtMsgLog(); + etMsgLog.setPhone(phone); + etMsgLog.setContent("您名下有一笔租车订单已归还,订单金额:"+ amount +"元。"); + etMsgLog.setType("1"); + etMsgLog.setSignName(signName); + etMsgLog.setTemplateCode(templateCode); + int i = etMsgLogMapper.insertEtMsgLog(etMsgLog); + if(i>0){ + logger.info("【微信支付回调】短信日志记录成功"); + }else{ + logger.info("【微信支付回调】短信日志记录失败"); + } + }, 0 , TimeUnit.HOURS); + } + private void asynchronousSaveCallbackLog(EtCallbackLog etCallbackLog) { //开异步线程保存回调参数 scheduledExecutorService.schedule(() -> { diff --git a/electripper-system/src/main/java/com/ruoyi/system/service/impl/EtFeeRuleServiceImpl.java b/electripper-system/src/main/java/com/ruoyi/system/service/impl/EtFeeRuleServiceImpl.java index ac8c15f..91d68f5 100644 --- a/electripper-system/src/main/java/com/ruoyi/system/service/impl/EtFeeRuleServiceImpl.java +++ b/electripper-system/src/main/java/com/ruoyi/system/service/impl/EtFeeRuleServiceImpl.java @@ -8,6 +8,9 @@ import com.ruoyi.common.core.domain.entity.SysDept; import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.system.domain.EtAreaRule; +import com.ruoyi.system.domain.EtOperatingArea; +import com.ruoyi.system.mapper.EtAreaRuleMapper; import com.ruoyi.system.service.IEtOperatingAreaService; import com.ruoyi.system.service.IWxPayService; import org.springframework.beans.factory.annotation.Autowired; @@ -16,6 +19,8 @@ import com.ruoyi.system.mapper.EtFeeRuleMapper; import com.ruoyi.system.domain.EtFeeRule; import com.ruoyi.system.service.IEtFeeRuleService; +import javax.annotation.Resource; + /** * 收费方式Service业务层处理 * @@ -25,7 +30,7 @@ import com.ruoyi.system.service.IEtFeeRuleService; @Service public class EtFeeRuleServiceImpl implements IEtFeeRuleService { - @Autowired + @Resource private EtFeeRuleMapper etFeeRuleMapper; @Autowired @@ -34,6 +39,9 @@ public class EtFeeRuleServiceImpl implements IEtFeeRuleService @Autowired private IWxPayService wxPayService; + @Resource + private EtAreaRuleMapper etAreaRuleMapper; + /** * 查询收费方式 * @@ -44,7 +52,11 @@ public class EtFeeRuleServiceImpl implements IEtFeeRuleService public EtFeeRule selectEtFeeRuleByRuleId(Long ruleId) { EtFeeRule etFeeRule = etFeeRuleMapper.selectEtFeeRuleByRuleId(ruleId); - etFeeRule.setArea(etOperatingAreaService.selectEtOperatingAreaByAreaId(etFeeRule.getAreaId())); + EtOperatingArea area = etOperatingAreaService.selectEtOperatingAreaByAreaId(etFeeRule.getAreaId()); + if(ObjectUtil.isNotNull(area)){ + etFeeRule.setArea(area); + etFeeRule.setAreaId(area.getAreaId()); + } return etFeeRule; } @@ -105,7 +117,11 @@ public class EtFeeRuleServiceImpl implements IEtFeeRuleService } etFeeRule.setCreateTime(DateUtils.getNowDate()); etFeeRule.setStatus("0"); - return etFeeRuleMapper.insertEtFeeRule(etFeeRule); + int i = etFeeRuleMapper.insertEtFeeRule(etFeeRule); + if(ObjectUtil.isNotNull(etFeeRule.getAreaId())){ + etAreaRuleMapper.insert(EtAreaRule.builder().areaId(etFeeRule.getAreaId()).ruleId(etFeeRule.getRuleId()).build()); + } + return i; } /** @@ -117,6 +133,10 @@ public class EtFeeRuleServiceImpl implements IEtFeeRuleService @Override public int updateEtFeeRule(EtFeeRule etFeeRule) { + int i = etAreaRuleMapper.deleteAreaRuleByRuleId(etFeeRule.getRuleId()); + if(ObjectUtil.isNotNull(etFeeRule.getAreaId())){ + etAreaRuleMapper.insert(EtAreaRule.builder().areaId(etFeeRule.getAreaId()).ruleId(etFeeRule.getRuleId()).build()); + } return etFeeRuleMapper.updateEtFeeRule(etFeeRule); } diff --git a/electripper-system/src/main/java/com/ruoyi/system/service/impl/EtMsgLogServiceImpl.java b/electripper-system/src/main/java/com/ruoyi/system/service/impl/EtMsgLogServiceImpl.java new file mode 100644 index 0000000..d70e7cb --- /dev/null +++ b/electripper-system/src/main/java/com/ruoyi/system/service/impl/EtMsgLogServiceImpl.java @@ -0,0 +1,95 @@ +package com.ruoyi.system.service.impl; + +import java.util.List; +import com.ruoyi.common.utils.DateUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ruoyi.system.mapper.EtMsgLogMapper; +import com.ruoyi.system.domain.EtMsgLog; +import com.ruoyi.system.service.IEtMsgLogService; + +/** + * 短信日志Service业务层处理 + * + * @author qiuzhenzhen + * @date 2024-07-24 + */ +@Service +public class EtMsgLogServiceImpl implements IEtMsgLogService +{ + @Autowired + private EtMsgLogMapper etMsgLogMapper; + + /** + * 查询短信日志 + * + * @param id 短信日志主键 + * @return 短信日志 + */ + @Override + public EtMsgLog selectEtMsgLogById(Long id) + { + return etMsgLogMapper.selectEtMsgLogById(id); + } + + /** + * 查询短信日志列表 + * + * @param etMsgLog 短信日志 + * @return 短信日志 + */ + @Override + public List selectEtMsgLogList(EtMsgLog etMsgLog) + { + return etMsgLogMapper.selectEtMsgLogList(etMsgLog); + } + + /** + * 新增短信日志 + * + * @param etMsgLog 短信日志 + * @return 结果 + */ + @Override + public int insertEtMsgLog(EtMsgLog etMsgLog) + { + etMsgLog.setCreateTime(DateUtils.getNowDate()); + return etMsgLogMapper.insertEtMsgLog(etMsgLog); + } + + /** + * 修改短信日志 + * + * @param etMsgLog 短信日志 + * @return 结果 + */ + @Override + public int updateEtMsgLog(EtMsgLog etMsgLog) + { + return etMsgLogMapper.updateEtMsgLog(etMsgLog); + } + + /** + * 批量删除短信日志 + * + * @param ids 需要删除的短信日志主键 + * @return 结果 + */ + @Override + public int deleteEtMsgLogByIds(Long[] ids) + { + return etMsgLogMapper.deleteEtMsgLogByIds(ids); + } + + /** + * 删除短信日志信息 + * + * @param id 短信日志主键 + * @return 结果 + */ + @Override + public int deleteEtMsgLogById(Long id) + { + return etMsgLogMapper.deleteEtMsgLogById(id); + } +} diff --git a/electripper-system/src/main/resources/mapper/system/AsDeviceMapper.xml b/electripper-system/src/main/resources/mapper/system/AsDeviceMapper.xml index 0045059..3f2df8e 100644 --- a/electripper-system/src/main/resources/mapper/system/AsDeviceMapper.xml +++ b/electripper-system/src/main/resources/mapper/system/AsDeviceMapper.xml @@ -355,4 +355,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{deviceId} + + + update et_device d set d.status = '0' where device_id in + + #{deviceId} + + diff --git a/electripper-system/src/main/resources/mapper/system/EtAreaRuleMapper.xml b/electripper-system/src/main/resources/mapper/system/EtAreaRuleMapper.xml index f36810f..ad8592e 100644 --- a/electripper-system/src/main/resources/mapper/system/EtAreaRuleMapper.xml +++ b/electripper-system/src/main/resources/mapper/system/EtAreaRuleMapper.xml @@ -7,4 +7,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" delete from et_area_rule where area_id=#{areaId} + + + delete from et_area_rule where rule_id=#{ruleId} + diff --git a/electripper-system/src/main/resources/mapper/system/EtFeeRuleMapper.xml b/electripper-system/src/main/resources/mapper/system/EtFeeRuleMapper.xml index ca7748e..7e47fea 100644 --- a/electripper-system/src/main/resources/mapper/system/EtFeeRuleMapper.xml +++ b/electripper-system/src/main/resources/mapper/system/EtFeeRuleMapper.xml @@ -36,17 +36,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + + and type = #{type} + and content = #{content} + and phone = #{phone} + + + + + + + insert into et_msg_log + + type, + templateCode, + signName, + content, + create_time, + phone, + + + #{type}, + #{templateCode}, + #{signName}, + #{content}, + #{createTime}, + #{phone}, + + + + + update et_msg_log + + type = #{type}, + templateCode = #{templateCode}, + signName = #{signName}, + content = #{content}, + create_time = #{createTime}, + phone = #{phone}, + + where id = #{id} + + + + delete from et_msg_log where id = #{id} + + + + delete from et_msg_log where id in + + #{id} + + + \ No newline at end of file