小票打印 短信配置 支付

This commit is contained in:
大魔王 2024-08-31 16:58:28 +08:00
parent 40023d01d0
commit 8ed0407b3f
30 changed files with 801 additions and 11 deletions

View File

@ -17,6 +17,10 @@ public class PaymentRuleConfigController extends BaseController {
public ResponseObject getList(PaymentRuleConfig paymentRuleConfig){
return getSuccessResult(paymentRuleConfigService.selectList(paymentRuleConfig));
}
@GetMapping("/selectList")
public ResponseObject selectList(PaymentRuleConfig paymentRuleConfig){
return getSuccessResult(paymentRuleConfigService.selectListRuleConfig(paymentRuleConfig));
}
@GetMapping("{id}")
public ResponseObject getInfo(@PathVariable Integer id){

View File

@ -14,6 +14,8 @@ public interface PaymentRuleConfigService extends IService<PaymentRuleConfig> {
*/
List<PaymentRuleConfigVo> selectList(PaymentRuleConfig paymentRuleConfig);
List<PaymentRuleConfig> selectListRuleConfig(PaymentRuleConfig paymentRuleConfig);
/**
* 根据id查询详情信息
* @param id

View File

@ -38,6 +38,20 @@ public class PaymentRuleConfigServiceImpl extends ServiceImpl<PaymentRuleConfigM
return list;
}
@Override
public List<PaymentRuleConfig> selectListRuleConfig(PaymentRuleConfig paymentRuleConfig) {
List<PaymentRuleConfig> paymentRuleConfigs = baseMapper.selectList(new QueryWrapper<>(paymentRuleConfig));
if (ObjectUtil.isNotEmpty(paymentRuleConfigs)) {
for (PaymentRuleConfig ruleConfig : paymentRuleConfigs) {
List<OilConfigVo> oilConfigs = oilConfigService.selectListByRuleConfigId(ruleConfig.getId());
ruleConfig.setRuleList(oilConfigs);
}
return paymentRuleConfigs;
}
return paymentRuleConfigs;
}
@Override
public PaymentRuleConfig selectRuleById(Integer id) {
PaymentRuleConfig paymentRuleConfig = baseMapper.selectById(id);
@ -64,10 +78,12 @@ public class PaymentRuleConfigServiceImpl extends ServiceImpl<PaymentRuleConfigM
}
int row = baseMapper.insert(ruleConfig);
paymentRuleConfig = selectRuleByRuleName(ruleConfig.getRuleName(), ruleConfig.getStoreId());
if (ObjectUtil.isNotEmpty(ruleConfig.getRuleList())){
for (OilConfigVo oilConfig : ruleConfig.getRuleList()) {
oilConfig.setRuleConfigId(paymentRuleConfig.getId());
oilConfigService.insertOilConfig(oilConfig);
if (ObjectUtil.isNotEmpty(paymentRuleConfig)) {
if (ObjectUtil.isNotEmpty(ruleConfig.getRuleList())){
for (OilConfigVo oilConfig : ruleConfig.getRuleList()) {
oilConfig.setRuleConfigId(paymentRuleConfig.getId());
oilConfigService.insertOilConfig(oilConfig);
}
}
}
return row;

View File

@ -83,5 +83,13 @@ public class MessageCostController extends BaseController {
return getSuccessResult(messageCostService.deleteById(id));
}
@GetMapping("/getRechargeList")
public ResponseObject getRechargeList(Integer storeId,
@RequestParam(value = "page",defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize){
Page page =new Page(pageNo,pageSize);
return getSuccessResult(messageCostService.getRechargeList(page,storeId));
}
}

View File

@ -83,5 +83,13 @@ public class MessageRecordController extends BaseController {
return getSuccessResult(messageRecordService.deleteById(id));
}
@GetMapping("/selectChildList")
public ResponseObject selectChildList(Integer messageRecordId,
@RequestParam(value = "page",defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize){
Page page =new Page(pageNo,pageSize);
return getSuccessResult(messageRecordService.selectChildList(page,messageRecordId));
}
}

View File

@ -17,6 +17,7 @@ import com.fuint.framework.web.BaseController;
import com.fuint.framework.web.ResponseObject;
import com.fuint.system.dept.entity.SysDept;
import com.fuint.system.dept.service.ISysDeptService;
import com.fuint.system.role.service.DutyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -43,6 +44,9 @@ public class MessageTemplateController extends BaseController {
private SysLogService sysLogService;
@Autowired
private ISysDeptService deptService;
@Resource
private DutyService dutyService;
/**
* 分页查询所有数据
*
@ -52,6 +56,9 @@ public class MessageTemplateController extends BaseController {
*/
@GetMapping
public ResponseObject selectAll(Page<MessageTemplate> page, MessageTemplate messageTemplate) {
//获取当前登录用户
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
LambdaQueryWrapper<MessageTemplate> queryWrapper =new LambdaQueryWrapper<>();
if (!StringUtils.isEmpty(messageTemplate.getName())){
queryWrapper.like(MessageTemplate::getName,messageTemplate.getName());
@ -59,6 +66,10 @@ public class MessageTemplateController extends BaseController {
if (!StringUtils.isEmpty(messageTemplate.getStatus())){
queryWrapper.eq(MessageTemplate::getStatus,messageTemplate.getStatus());
}
queryWrapper.eq(MessageTemplate::getStoreId,nowAccountInfo.getStoreId());
if (messageTemplate.getRoeleList() != null && messageTemplate.getRoeleList().size() > 0 ) {
queryWrapper.like(MessageTemplate::getRoleIds, messageTemplate.getRoeleList().get(0));
}
queryWrapper.orderByDesc(MessageTemplate::getCreateTime);
IPage<MessageTemplate> page1 = this.messageTemplateService.page(page,queryWrapper);
for (MessageTemplate record : page1.getRecords()) {
@ -67,7 +78,15 @@ public class MessageTemplateController extends BaseController {
deptIdList.add(Integer.parseInt(s));
}
record.setDeptIdList(deptIdList);
}
if (record.getRoleIds() != null && !record.getRoleIds().equals("")) {
String roleById = "";
for (String s : record.getRoleIds().split(",")) {
roleById += dutyService.getRoleById(Long.parseLong(s)).getDutyName();
}
record.setRoleIds(roleById);
}
}
return getSuccessResult(page1);
}
@ -105,8 +124,21 @@ public class MessageTemplateController extends BaseController {
tempId+=dept.getDeptId()+",";
}
String roleIds = "";
for (Integer integer : messageTemplate.getRoeleList()) {
roleIds += integer + ",";
}
messageTemplate.setRoleIds(roleIds);
messageTemplate.setDeptNames(tempName.substring(0,tempName.length()-1));
messageTemplate.setDeptIds(tempId.substring(0,tempId.length()-1));
messageTemplate.setStoreId(nowAccountInfo.getStoreId());
// 校验添加时名称是否存在
int nameList = messageTemplateService.selectMessagesName(messageTemplate.getName());
if (nameList == 1) {
return getFailureResult(201,"模版名称已存在");
}
return getSuccessResult(this.messageTemplateService.save(messageTemplate));
}
@ -133,6 +165,11 @@ public class MessageTemplateController extends BaseController {
}
messageTemplate.setDeptNames(tempName.substring(0,tempName.length()-1));
messageTemplate.setDeptIds(tempId.substring(0,tempId.length()-1));
// // 校验添加时名称是否存在
// int nameList = this.getNameList(messageTemplate.getName());
// if (nameList == 1) {
// return getFailureResult(201,"模版名称已存在");
// }
return getSuccessResult(this.messageTemplateService.updateById(messageTemplate));
}
@ -154,5 +191,20 @@ public class MessageTemplateController extends BaseController {
}
return getSuccessResult(this.messageTemplateService.removeByIds(idList));
}
/**
* 查询消息模板名称是否存在
* @param name 模板名称
* @return 1 , 0
*/
@GetMapping("/getMessageTemplate")
public ResponseObject getMessageTemplate(String name){
return getSuccessResult( messageTemplateService.selectMessagesName(name));
}
private int getNameList(String name) {
int i = messageTemplateService.selectMessagesName(name);
return i;
}
}

View File

@ -0,0 +1,43 @@
package com.fuint.business.setting.controller;
import com.fuint.business.setting.entity.ReceiptPrinting;
import com.fuint.business.setting.service.ReceiptPrintingService;
import com.fuint.framework.web.BaseController;
import com.fuint.framework.web.ResponseObject;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
/**
* @author : ls
* @className: ReceiptPrintingController
* @date : 2024-08-30 10:18
**/
@RestController
@RequestMapping("receiptPrinting")
public class ReceiptPrintingController extends BaseController {
@Resource
private ReceiptPrintingService receiptPrintingService;
@PostMapping("/addReceiptPrinting")
public ResponseObject addReceiptPrinting(@RequestBody ReceiptPrinting receiptPrinting) {
int i = receiptPrintingService.addReceiptPrinting(receiptPrinting);
if (i > 0) {
return getSuccessResult("成功");
}
return getFailureResult(1000, "失败");
}
/**
* 根据 油站id查询
* @param receiptPrinting
* @return
*/
@GetMapping("/queryReceiptPrintingList")
public ResponseObject queryReceiptPrintingList(ReceiptPrinting receiptPrinting) {
return getSuccessResult(receiptPrintingService.queryReceiptPrintingList(receiptPrinting));
}
}

View File

@ -0,0 +1,24 @@
package com.fuint.business.setting.entity;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
/**
* @author : ls
* @className: MessageCostRechargeRecordRepVO
* @date : 2024-08-29 11:17
**/
@Data
public class MessageCostRechargeRecordRepVO {
private String deptName;
private BigDecimal amount;
private BigDecimal unitPrice;
private int messageNum;
private String rechargeUser;
private Date createTime;
}

View File

@ -1,12 +1,15 @@
package com.fuint.business.setting.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fuint.framework.entity.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
import java.io.Serializable;
@ -78,5 +81,26 @@ public class MessageRecord extends BaseEntity implements Serializable {
*/
private String updateBy;
/**
* 发送时间
*/
private Date sendTime;
/**
*发送人
*/
@TableField(exist = false)
private String messageSendee;
/**
*模板名称
*/
@TableField(exist = false)
private String name;
/**
*模板内容
*/
@TableField(exist = false)
private String content;
}

View File

@ -1,6 +1,7 @@
package com.fuint.business.setting.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fuint.framework.entity.BaseEntity;
@ -69,5 +70,10 @@ public class MessageRecordChild extends BaseEntity implements Serializable {
* 更新人
*/
private String updateBy;
/**
* 所属机构
*/
@TableField(exist = false)
private String deptNames;
}

View File

@ -49,6 +49,10 @@ public class MessageTemplate extends Model<MessageTemplate> {
@TableField(exist = false)
private List<Integer> deptIdList;
private String deptNames;
private Integer storeId;
@TableField(exist = false)
private List<Integer> roeleList;
}

View File

@ -0,0 +1,156 @@
package com.fuint.business.setting.entity;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fuint.framework.entity.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* 短信记录(MessageRecord)实体类
*
* @author makejava
* @since 2024-08-26 16:47:15
*/
@Data
@TableName("receipt_printing")
@ApiModel(value = "ReceiptPrinting对象", description = "小票打印设置")
public class ReceiptPrinting extends BaseEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
@ApiModelProperty("ID")
@TableId(value = "ID", type = IdType.AUTO)
private Integer id;
/**
* logo设置(0 定义1 不定义)
*/
private String logoSet;
/**
* 抬头脚注设置0 店铺名称1 标题2小票类型3 脚注
*/
private String headfootSet;
@TableField(exist = false)
private List<Integer> headfootSets;
/**
* 店铺名称
*/
private String shopName;
/**
* 标题
*/
private String title;
/**
* 小票类型
*/
private String receiptType;
/**
* 脚注
*/
private String foot;
/**
* 顶部设置(0订单号,1会员号,2车牌号,3会员等级,4手机,5余额,6积分)
*/
private String topSet;
@TableField(exist = false)
private List<Integer> topSets;
/**
* 订单编号
*/
private String orderNumber;
/**
* 会员卡号
*/
private String memberCard;
/**
* 车牌号
*/
private String plateNumber;
/**
* 会员等级
*/
private String membershipLevel;
/**
* 手机号码
*/
private String phoneNumber;
/**
* 会员积分
*/
private String memberPoints;
/**
* 底部设置(0操作时间,1联系方式,2操作员,3地址,4备注)
*/
private String bottomSet;
@TableField(exist = false)
private List<Integer> bottomSets;
/**
* 操作时间
*/
private Date operateTime;
/**
* 联系方式
*/
private String contactWay;
/**
* 操作员
*/
private String consoleOperator;
/**
* 地址
*/
private String address;
/**
* 备注
*/
private String remarks;
/**
* 二维码设置
*/
private String codeSet;
/**
* 是否删除
*/
private Integer deleted;
/**
* 二维码图片
*/
private String codeImage;
/**
* logo图片
*/
private String logeImage;
/**
* 油站id
*/
private Integer storeId;
/**
* 创建人名称
*/
private String createName;
/**
* 创建时间
*/
private Date createTime;
/**
* 创建人
*/
private String createBy;
/**
* 更新时间
*/
private Date updateTime;
/**
* 更新人
*/
private String updateBy;
}

View File

@ -4,8 +4,11 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.setting.entity.MessageCost;
import com.fuint.business.setting.entity.MessageCostRechargeRecordRepVO;
import org.apache.ibatis.annotations.Param;
public interface MessageCostMapper extends BaseMapper<MessageCost> {
IPage<MessageCost> queryPage(Page page, @Param("entity") MessageCost messageCost);
IPage<MessageCostRechargeRecordRepVO> getRechargeList(Page page,@Param("storeId")Integer storeId);
}

View File

@ -4,8 +4,17 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.setting.entity.MessageRecord;
import com.fuint.business.setting.entity.MessageRecordChild;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface MessageRecordMapper extends BaseMapper<MessageRecord> {
IPage<MessageRecord> queryPage(Page page, @Param("entity") MessageRecord messageRecord);
int insertRecord(@Param("messageRecord") MessageRecord messageRecord);
IPage<MessageRecord> selectPage(Page page, @Param("entity") MessageRecord messageRecord);
IPage<MessageRecordChild> selectChildList(Page page,@Param("messageRecordId") Integer messageRecordId);
}

View File

@ -2,8 +2,11 @@ package com.fuint.business.setting.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fuint.business.setting.entity.MessageTemplate;
import org.apache.ibatis.annotations.Param;
import org.mapstruct.Mapper;
import java.util.List;
/**
* (MessageTemplate)表数据库访问层
*
@ -13,5 +16,12 @@ import org.mapstruct.Mapper;
@Mapper
public interface MessageTemplateMapper extends BaseMapper<MessageTemplate> {
/**
* 查询消息模板名称是否存在
* @param name 模板名称
* @return list
*/
List<MessageTemplate> selectMessagesName(@Param("templateName") String name);
}

View File

@ -0,0 +1,23 @@
package com.fuint.business.setting.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fuint.business.setting.entity.ReceiptPrinting;
import org.apache.ibatis.annotations.Param;
import org.mapstruct.Mapper;
import java.util.List;
/**
* (ReceiptPrinting)表数据库访问层
*
* @author makejava
* @since 2024-07-18 15:37:16
*/
@Mapper
public interface ReceiptPrintingMapper extends BaseMapper<ReceiptPrinting> {
// 更具 stordid查询当前油站小票打印配置
List<ReceiptPrinting> queryReceiptPrintingList(@Param("receiptPrinting") ReceiptPrinting receiptPrinting);
}

View File

@ -2,7 +2,7 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.fuint.business.setting.mapper.MessageCostMapper">
<select id="queryPage" resultType="com.fuint.business.setting.entity.MessageCost">
<!--<select id="queryPage" resultType="com.fuint.business.setting.entity.MessageCost">
SELECT * FROM message_cost
<where>
<if test="entity.chainStoreId != null and entity.chainStoreId != ''">
@ -14,14 +14,68 @@
<if test="entity.createBy != null and entity.createBy != ''">
and create_by = #{entity.createBy}
</if>
<if test="entity.params.beginTime != null and entity.params.beginTime != ''"><!-- 开始时间检索 -->
<if test="entity.params.beginTime != null and entity.params.beginTime != ''">&lt;!&ndash; 开始时间检索 &ndash;&gt;
and date_format(create_time,'%y%m%d') &gt;= date_format(#{entity.params.beginTime},'%y%m%d')
</if>
<if test="entity.params.endTime != null and entity.params.endTime != ''"><!-- 结束时间检索 -->
<if test="entity.params.endTime != null and entity.params.endTime != ''">&lt;!&ndash; 结束时间检索 &ndash;&gt;
and date_format(create_time,'%y%m%d') &lt;= date_format(#{entity.params.endTime},'%y%m%d')
</if>
</where>
ORDER BY create_time DESC
</select>-->
<select id="queryPage" resultType="com.fuint.business.setting.entity.MessageCost">
SELECT
co.id,
co.chain_store_id,
co.store_id,
co.dept_id,
co.contacts,
co.mobile,
a.balance,
co.message_num,(
a.residue_num - co.message_num
) AS residue_num,
a.recharge_record,
co.create_name,
co.create_time,
co.create_by,
co.update_time,
co.update_by
FROM
message_cost co
LEFT JOIN (
SELECT
SUM( amount ) AS balance,
SUM( message_num ) AS residue_num,
store_id, COUNT(1) AS recharge_record FROM message_recharge_record WHERE store_id = #{entity.storeId} ) a ON co.store_id = a.store_id
<where>
and co.store_id = #{entity.storeId}
<if test="entity.deptId != null">
and co.dept_id = #{entity.deptId}
</if>
<if test="entity.createName != null and entity.createName != ''">
and co.create_name like concat('%',#{entity.createName},'%')
</if>
</where>
ORDER BY
co.create_time DESC
</select>
<select id="getRechargeList" resultType="com.fuint.business.setting.entity.MessageCostRechargeRecordRepVO">
SELECT
de.dept_name,
re.amount,
re.unit_price,
re.message_num,
re.recharge_user,
re.create_time
FROM
`message_cost` co
LEFT JOIN message_recharge_record re ON co.store_id = #{storeId}
LEFT JOIN sys_dept de ON de.dept_id = co.dept_id
ORDER BY
re.create_time DESC
</select>
</mapper>

View File

@ -26,5 +26,54 @@
</where>
ORDER BY create_time DESC
</select>
<insert id="insertRecord" useGeneratedKeys="true" keyProperty="id">
INSERT INTO message_record(message_id,store_id,send_status,create_time,create_by,send_time, create_name, send_num, success_num)
VALUES(#{messageRecord.messageId},#{messageRecord.storeId},#{messageRecord.sendStatus},#{messageRecord.createTime},
#{messageRecord.createBy},#{messageRecord.sendTime},#{messageRecord.createName},#{messageRecord.sendNum}, #{messageRecord.successNum})
</insert>
<select id="selectPage" resultType="com.fuint.business.setting.entity.MessageRecord">
SELECT
re.id,
te.`name`,
te.content,
te.role_ids,
re.send_num,
re.success_num,
re.send_status,
re.create_name,
re.send_time
FROM
`message_record` re
LEFT JOIN message_template te ON re.message_id = te.id
WHERE
re.store_id = #{entity.storeId}
<if test="entity.messageId != null and entity.messageId != ''" >
AND re.message_id = #{entity.messageId}
</if>
<if test="entity.name != null and entity.name != ''">
AND te.name like concat('%', #{entity.name}, '%')
</if>
<if test="entity.roleIds != null and entity.roleIds != ''">
AND te.role_ids like concat('%', #{entity.roleIds}, '%')
</if>
ORDER BY
re.create_time DESC
</select>
<select id="selectChildList" resultType="com.fuint.business.setting.entity.MessageRecordChild">
SELECT
te.dept_names,
ch.mobile,
ch.`status`,
ch.message_num
FROM
message_record_child ch
LEFT JOIN message_record re ON ch.message_record_id = re.id
LEFT JOIN message_template te ON te.id = re.message_id
WHERE
ch.message_record_id = #{messageRecordId}
</select>
</mapper>

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.fuint.business.setting.mapper.MessageTemplateMapper">
<sql id="selectMessagesName">
id,name,content,dept_ids,dept_names,role_ids,status,create_name,create_time,create_by,update_time,update_by,
message_id
</sql>
<select id="selectMessagesName" resultType="com.fuint.business.setting.entity.MessageTemplate">
SELECT <include refid="selectMessagesName"></include>
FROM `message_template` WHERE `name` = #{templateName}
</select>
</mapper>

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.fuint.business.setting.mapper.ReceiptPrintingMapper">
<select id="queryReceiptPrintingList" resultType="com.fuint.business.setting.entity.ReceiptPrinting">
SELECT
*
FROM
receipt_printing
WHERE
store_id = #{receiptPrinting.storeId} and deleted = 0
order by id desc
</select>
</mapper>

View File

@ -3,6 +3,7 @@ package com.fuint.business.setting.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.setting.entity.MessageCost;
import com.fuint.business.setting.entity.MessageCostRechargeRecordRepVO;
/**
* 短信费用信息表(MessageCost)表服务接口
@ -53,4 +54,11 @@ public interface MessageCostService {
*/
int deleteById(Integer id);
/**
* 根据stroeId获取充值记录
* @param storeId 油站id
* @return 分页列表
*/
IPage<MessageCostRechargeRecordRepVO> getRechargeList(Page page, Integer storeId);
}

View File

@ -3,8 +3,11 @@ package com.fuint.business.setting.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.setting.entity.MessageRecord;
import com.fuint.business.setting.entity.MessageRecordChild;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 短信记录(MessageRecord)表服务接口
*
@ -52,4 +55,6 @@ public interface MessageRecordService {
*/
int deleteById(Integer id);
IPage<MessageRecordChild> selectChildList(Page page,Integer messageRecordId);
}

View File

@ -11,5 +11,7 @@ import com.fuint.business.setting.entity.MessageTemplate;
*/
public interface MessageTemplateService extends IService<MessageTemplate> {
int selectMessagesName(String name);
}

View File

@ -0,0 +1,23 @@
package com.fuint.business.setting.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.fuint.business.setting.entity.ReceiptPrinting;
import com.fuint.framework.web.ResponseObject;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @author : ls
* @interfaceName: ReceiptPrintingService
* @date : 2024-08-30 09:59
**/
public interface ReceiptPrintingService extends IService<ReceiptPrinting> {
int addReceiptPrinting(ReceiptPrinting receiptPrinting);
ReceiptPrinting queryReceiptPrintingList(ReceiptPrinting receiptPrinting);
}

View File

@ -6,12 +6,14 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fuint.business.setting.entity.MessageCost;
import com.fuint.business.setting.entity.MessageCostRechargeRecordRepVO;
import com.fuint.business.setting.mapper.MessageCostMapper;
import com.fuint.business.setting.service.MessageCostService;
import com.fuint.common.dto.AccountInfo;
import com.fuint.common.util.TokenUtil;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Objects;
@ -24,8 +26,13 @@ import java.util.Objects;
@Service("messageCostService")
public class MessageCostServiceImpl extends ServiceImpl<MessageCostMapper,MessageCost> implements MessageCostService {
@Resource
private MessageCostMapper messageCostMapper;
@Override
public IPage<MessageCost> queryPage(Page page, MessageCost messageCost) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
messageCost.setStoreId(nowAccountInfo.getStoreId());
return baseMapper.queryPage(page,messageCost);
}
@ -62,6 +69,7 @@ public class MessageCostServiceImpl extends ServiceImpl<MessageCostMapper,Messag
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
messageCost.setChainStoreId(nowAccountInfo.getChainStoreId());
messageCost.setStoreId(nowAccountInfo.getStoreId());
messageCost.setCreateName(nowAccountInfo.getRealName());
return baseMapper.insert(messageCost);
}
@ -90,4 +98,9 @@ public class MessageCostServiceImpl extends ServiceImpl<MessageCostMapper,Messag
public int deleteById(Integer id) {
return baseMapper.deleteById(id);
}
@Override
public IPage<MessageCostRechargeRecordRepVO> getRechargeList(Page page, Integer storeId) {
return messageCostMapper.getRechargeList(page, storeId);
}
}

View File

@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fuint.business.setting.entity.MessageRechargeRecord;
import com.fuint.business.setting.mapper.MessageRechargeRecordMapper;
import com.fuint.business.setting.service.MessageRechargeRecordService;
import com.fuint.common.dto.AccountInfo;
import com.fuint.common.util.TokenUtil;
import org.springframework.stereotype.Service;
/**
@ -34,6 +36,10 @@ public class MessageRechargeRecordServiceImpl extends ServiceImpl<MessageRecharg
*/
@Override
public int insert(MessageRechargeRecord messageRechargeRecord) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
messageRechargeRecord.setStoreId(nowAccountInfo.getStoreId());
return baseMapper.insert(messageRechargeRecord);
}

View File

@ -4,9 +4,20 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fuint.business.setting.entity.MessageRecord;
import com.fuint.business.setting.entity.MessageRecordChild;
import com.fuint.business.setting.mapper.MessageRecordChildMapper;
import com.fuint.business.setting.mapper.MessageRecordMapper;
import com.fuint.business.setting.service.MessageRecordService;
import com.fuint.common.dto.AccountInfo;
import com.fuint.common.util.TokenUtil;
import com.fuint.system.role.mapper.TDutyMapper;
import com.fuint.system.role.service.DutyService;
import org.dom4j.CDATA;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
/**
* 短信记录(MessageRecord)表服务实现类
@ -17,9 +28,37 @@ import org.springframework.stereotype.Service;
@Service("messageRecordService")
public class MessageRecordServiceImpl extends ServiceImpl<MessageRecordMapper,MessageRecord> implements MessageRecordService {
@Resource
private MessageRecordChildMapper messageRecordChildMapper;
@Resource
private MessageRecordMapper messageRecordMapper;
@Resource
private DutyService dutyService;
@Override
public IPage<MessageRecord> queryPage(Page page, MessageRecord messageRecord) {
return baseMapper.queryPage(page,messageRecord);
AccountInfo nowAccountInfo = this.getUserInfo();
messageRecord.setStoreId(nowAccountInfo.getStoreId());
/*Date date = new Date(String.valueOf(messageRecord.getSendTime()));
messageRecord.setSendTime(date);*/
IPage<MessageRecord> record = messageRecordMapper.selectPage(page, messageRecord);
if (record.getRecords() != null && record.getRecords().size() > 0) {
for (MessageRecord recordRecord : record.getRecords()) {
if (recordRecord.getRoleIds() != null && !recordRecord.getRoleIds().equals("")) {
String roleById = "";
for (String s : recordRecord.getRoleIds().split(",")) {
roleById += dutyService.getRoleById(Long.parseLong(s)).getDutyName();
}
recordRecord.setRoleIds(roleById);
}
}
}
return record;
// return baseMapper.queryPage(page,messageRecord);
}
/**
@ -41,7 +80,51 @@ public class MessageRecordServiceImpl extends ServiceImpl<MessageRecordMapper,Me
*/
@Override
public int insert(MessageRecord messageRecord) {
return baseMapper.insert(messageRecord);
AccountInfo nowAccountInfo = this.getUserInfo();
String messageSendee = messageRecord.getMessageSendee();
messageRecord.setStoreId(nowAccountInfo.getStoreId());
// 发送状态默认未0 目前
messageRecord.setSendStatus("0");
messageRecord.setCreateBy(nowAccountInfo.getId().toString());
messageRecord.setCreateTime(new Date());
String[] numberStrings = null;
if (messageSendee.contains(",")) {
numberStrings = messageSendee.split(",");
messageRecord.setSendNum(numberStrings.length);
}else {
messageRecord.setSendNum(1);
}
messageRecord.setSuccessNum(0); // 目前默认为0
messageRecord.setCreateName(nowAccountInfo.getAccountName());
int i = messageRecordMapper.insertRecord(messageRecord);
if (numberStrings != null) {
for (String numberString : numberStrings) {
messageRecordChildMapper.insert(this.addRecord(messageRecord.getId(), nowAccountInfo.getStoreId(), numberString));
}
return i;
}
messageRecordChildMapper.insert(this.addRecord(messageRecord.getId(), nowAccountInfo.getStoreId(), messageSendee));
return i;
}
public MessageRecordChild addRecord(Integer id, Integer storeId, String messageSendee) {
MessageRecordChild recordChild = new MessageRecordChild();
recordChild.setMessageRecordId(id);
recordChild.setStoreId(storeId);
recordChild.setMobile(messageSendee);
recordChild.setStatus("0"); // 目前默认未0
recordChild.setMessageNum(1);
return recordChild;
}
public AccountInfo getUserInfo(){
//获取当前登录用户
return TokenUtil.getNowAccountInfo();
}
/**
@ -65,4 +148,10 @@ public class MessageRecordServiceImpl extends ServiceImpl<MessageRecordMapper,Me
public int deleteById(Integer id) {
return baseMapper.deleteById(id);
}
@Override
public IPage<MessageRecordChild> selectChildList(Page page,Integer messageRecordId) {
return messageRecordMapper.selectChildList(page, messageRecordId);
}
}

View File

@ -6,6 +6,9 @@ import com.fuint.business.setting.entity.MessageTemplate;
import com.fuint.business.setting.service.MessageTemplateService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* (MessageTemplate)表服务实现类
*
@ -15,5 +18,16 @@ import org.springframework.stereotype.Service;
@Service("messageTemplateService")
public class MessageTemplateServiceImpl extends ServiceImpl<MessageTemplateMapper, MessageTemplate> implements MessageTemplateService {
@Resource
private MessageTemplateMapper messageTemplateMapper;
@Override
public int selectMessagesName(String name) {
List<MessageTemplate> messageTemplatesList = messageTemplateMapper.selectMessagesName(name);
if (messageTemplatesList != null && messageTemplatesList.size() >0) {
return 1;
}
return 0;
}
}

View File

@ -0,0 +1,105 @@
package com.fuint.business.setting.service.impl;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fuint.business.setting.entity.ReceiptPrinting;
import com.fuint.business.setting.mapper.ReceiptPrintingMapper;
import com.fuint.business.setting.service.ReceiptPrintingService;
import com.fuint.common.dto.AccountInfo;
import com.fuint.common.util.TokenUtil;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
/**
* @author : ls
* @className: ReceiptPrintingServiceImpl
* @date : 2024-08-30 10:00
**/
@Service
public class ReceiptPrintingServiceImpl extends ServiceImpl<ReceiptPrintingMapper, ReceiptPrinting> implements ReceiptPrintingService {
@Resource
private ReceiptPrintingMapper receiptPrintingMapper;
@Override
@Transactional
public int addReceiptPrinting(ReceiptPrinting receiptPrinting) {
// id不为空 查询 删除
if (receiptPrinting.getId() != null) {
ReceiptPrinting receiptPrinting1 = new ReceiptPrinting();
receiptPrinting1.setId(receiptPrinting.getId());
receiptPrinting1.setDeleted(1);
receiptPrintingMapper.updateById(receiptPrinting1);
}
// 为空进行新增
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
receiptPrinting.setStoreId(nowAccountInfo.getStoreId());
if (receiptPrinting.getHeadfootSets() != null && receiptPrinting.getHeadfootSets().size() > 0 ) {
receiptPrinting.setHeadfootSet(chke(receiptPrinting.getHeadfootSets()));
}
if (receiptPrinting.getTopSets() != null && receiptPrinting.getTopSets().size() > 0 ) {
receiptPrinting.setTopSet(chke(receiptPrinting.getTopSets()));
}
if (receiptPrinting.getBottomSets() != null && receiptPrinting.getBottomSets().size() > 0 ) {
receiptPrinting.setBottomSet(chke(receiptPrinting.getBottomSets()));
}
int insert = receiptPrintingMapper.insert(receiptPrinting);
return insert;
}
@Override
public ReceiptPrinting queryReceiptPrintingList(ReceiptPrinting receiptPrinting) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
receiptPrinting.setStoreId(nowAccountInfo.getStoreId());
List<ReceiptPrinting> receiptPrintings = receiptPrintingMapper.queryReceiptPrintingList(receiptPrinting);
// 处理参数
if (receiptPrintings != null && receiptPrintings.size() > 0 ) {
ReceiptPrinting printing = receiptPrintings.get(0);
if (ObjectUtil.isNotEmpty(printing.getHeadfootSet())) {
printing.setHeadfootSets(getList(printing.getHeadfootSet()));
}
if (ObjectUtil.isNotEmpty(printing.getTopSet())) {
printing.setTopSets(getList(printing.getTopSet()));
}
if (ObjectUtil.isNotEmpty(printing.getBottomSet())) {
printing.setBottomSets(getList(printing.getBottomSet()));
}
return printing;
}
return null;
}
public String chke(List<Integer> list) {
return list
.stream()
.map(String::valueOf)
.collect(Collectors.joining(", ", "[", "]"));
}
public List<Integer> getList(String str) {
String cleanedStr = str.replaceAll("[\\[\\]]", "");
return Arrays.stream(cleanedStr.split(",\\s*"))
.map(Integer::parseInt)
.collect(Collectors.toList());
}
}

View File

@ -4,7 +4,7 @@ env.profile=dev
#env.properties.path=D:/workspaces/oilSystem/fuintBackend/configure/
#env.properties.path=F:/work/oilSystem/fuintBackend/configure/
#env.properties.path=D:/oil/new-oil/oilSystem/fuintBackend/configure/
env.properties.path=D:/Code/yuzhan/oil-station/fuintBackend/configure
env.properties.path=D:/dianliang/server/fuintBackend/configure/
#env.properties.path=/www/wwwroot/shenlanshuke/oilAdmin/
# \u6570\u636E\u5E93\u914D\u7F6E