添加区域码和设备编码字段
This commit is contained in:
parent
5d8e9db6c1
commit
d3aedb6399
@ -30,12 +30,12 @@ public class UserRechargeController extends BaseController {
|
||||
/**
|
||||
* 修改用户充值卡金额
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('rechargecard:cards:edit')")
|
||||
/*@PreAuthorize("@ss.hasPermi('rechargecard:cards:edit')")
|
||||
@PutMapping
|
||||
@ApiOperation("修改用户充值卡")
|
||||
public AjaxResult result(@RequestBody RechargecardUser rechargecardUser)
|
||||
{
|
||||
|
||||
return toAjax(userRechargeCardsService.updateUserRecharge(rechargecardUser));
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
@ -84,4 +84,19 @@ public class NgUserRechargeRecords extends BaseEntity
|
||||
@ApiModelProperty("充值机编码")
|
||||
private String serialNumber;
|
||||
|
||||
/** 设备编码 */
|
||||
@Excel(name = "设备编码")
|
||||
@ApiModelProperty("设备编码")
|
||||
private String deviceNumber;
|
||||
|
||||
/** 项目编码 */
|
||||
@Excel(name = "项目编码")
|
||||
@ApiModelProperty("项目编码")
|
||||
private Long projectId;
|
||||
|
||||
/** 机构id */
|
||||
@Excel(name = "机构id")
|
||||
@ApiModelProperty("机构id")
|
||||
private Long deptId;
|
||||
|
||||
}
|
||||
|
@ -5,7 +5,6 @@ import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
@ -17,12 +16,11 @@ import com.fastbee.common.core.domain.BaseEntity;
|
||||
* 用户充值卡账单明细记录对象 user_consumption_details
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2024-12-18
|
||||
* @date 2024-12-19
|
||||
*/
|
||||
@ApiModel(value = "UserConsumptionDetails",description = "用户充值卡账单明细记录 user_consumption_details")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Builder
|
||||
public class UserConsumptionDetails extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
@ -101,19 +99,19 @@ public class UserConsumptionDetails extends BaseEntity
|
||||
private BigDecimal billingPeriodDuration;
|
||||
|
||||
/** 账单生成的日期 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:MM:SS")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "账单生成的日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
@ApiModelProperty("账单生成的日期")
|
||||
private Date billingDate;
|
||||
|
||||
/** 开泵时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:MM:SS")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "开泵时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
@ApiModelProperty("开泵时间")
|
||||
private Date startTime;
|
||||
|
||||
/** 关泵时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:MM:SS")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "关泵时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
@ApiModelProperty("关泵时间")
|
||||
private Date endTime;
|
||||
@ -129,7 +127,7 @@ public class UserConsumptionDetails extends BaseEntity
|
||||
private Integer paymentMethod;
|
||||
|
||||
/** 账单支付的时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:MM:SS")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = " 账单支付的时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
@ApiModelProperty(" 账单支付的时间")
|
||||
private Date paymentTime;
|
||||
@ -139,9 +137,9 @@ public class UserConsumptionDetails extends BaseEntity
|
||||
@ApiModelProperty("账单的当前状态,0:已支付、1:已取消")
|
||||
private Integer status;
|
||||
|
||||
/** 关于账单的额外信息或备注 */
|
||||
@Excel(name = "关于账单的额外信息或备注")
|
||||
@ApiModelProperty("关于账单的额外信息或备注")
|
||||
private String remark;
|
||||
/** 区域码 */
|
||||
@Excel(name = "区域码")
|
||||
@ApiModelProperty("区域码")
|
||||
private String areaCode;
|
||||
|
||||
}
|
||||
|
@ -20,6 +20,13 @@ public interface NgIrrigationControllersMapper
|
||||
* @return 灌溉控制器信息
|
||||
*/
|
||||
public NgIrrigationControllers selectNgIrrigationControllersById(Long id);
|
||||
/**
|
||||
* 查询灌溉控制器信息
|
||||
*
|
||||
* @param serialNumber 灌溉控制器编码
|
||||
* @return 灌溉控制器信息
|
||||
*/
|
||||
public NgIrrigationControllers selectNgIrrigationControllersBySerialNumber(String serialNumber);
|
||||
|
||||
/**
|
||||
* 查询灌溉控制器信息列表
|
||||
|
@ -28,6 +28,13 @@ public interface UserRechargeCardsMapper extends MPJBaseMapper<UserRechargeCards
|
||||
* @return 用户充值卡
|
||||
*/
|
||||
public UserRechargeCards selectUserRechargeCardsById(Long id);
|
||||
/**
|
||||
* 查询用户充值卡
|
||||
*
|
||||
* @param cardNumber
|
||||
* @return 用户充值卡
|
||||
*/
|
||||
public UserRechargeCards selectUserRechargeCardsByCardNumber(String cardNumber);
|
||||
|
||||
/**
|
||||
* card_number查询用户充值卡
|
||||
|
@ -69,5 +69,5 @@ public interface IUserRechargeCardsService
|
||||
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateUserRecharge(RechargecardUser rechargecardUser);
|
||||
/*public int updateUserRecharge(RechargecardUser rechargecardUser);*/
|
||||
}
|
||||
|
@ -54,6 +54,8 @@ public class NgUserRechargeRecordsServiceImpl implements INgUserRechargeRecordsS
|
||||
public int insertNgUserRechargeRecords(NgUserRechargeRecords ngUserRechargeRecords)
|
||||
{
|
||||
ngUserRechargeRecords.setCreateTime(DateUtils.getNowDate());
|
||||
ngUserRechargeRecordsMapper.insertNgUserRechargeRecords(ngUserRechargeRecords);
|
||||
|
||||
return ngUserRechargeRecordsMapper.insertNgUserRechargeRecords(ngUserRechargeRecords);
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,9 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import com.fastbee.common.utils.DateUtils;
|
||||
import com.fastbee.iot.mapper.DeviceMapper;
|
||||
import com.fastbee.rechargecard.domain.NgIrrigationControllers;
|
||||
import com.fastbee.rechargecard.domain.dto.UserIrrigationRecordDto;
|
||||
import com.fastbee.rechargecard.mapper.NgIrrigationControllersMapper;
|
||||
import com.fastbee.system.mapper.SysUserMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -27,7 +29,8 @@ public class UserIrrigationRecordServiceImpl implements IUserIrrigationRecordSer
|
||||
@Autowired
|
||||
private SysUserMapper sysUserMapper;
|
||||
@Autowired
|
||||
private DeviceMapper deviceMapper;
|
||||
private NgIrrigationControllersMapper ngIrrigationControllersMapper;
|
||||
|
||||
|
||||
@Override
|
||||
public List<UserIrrigationRecordDto> selectUserIrrigationRecordShowList(UserIrrigationRecord userIrrigationRecord) {
|
||||
@ -38,7 +41,7 @@ public class UserIrrigationRecordServiceImpl implements IUserIrrigationRecordSer
|
||||
UserIrrigationRecordDto temp=new UserIrrigationRecordDto();
|
||||
temp.id=list.get(i).getId();
|
||||
temp.userName= sysUserMapper.selectUserById(list.get(i).getUserId()).getUserName()==null ? "" :sysUserMapper.selectUserById(list.get(i).getUserId()).getUserName();
|
||||
temp.deviceName=deviceMapper.selectDeviceBySerialNumber(list.get(i).getDeviceNumber()).getDeviceName() == null ? "":deviceMapper.selectDeviceBySerialNumber(list.get(i).getDeviceNumber()).getDeviceName();
|
||||
temp.deviceName=ngIrrigationControllersMapper.selectNgIrrigationControllersBySerialNumber(list.get(i).getDeviceNumber()).getControllerName() == null ? "":ngIrrigationControllersMapper.selectNgIrrigationControllersBySerialNumber(list.get(i).getDeviceNumber()).getControllerName();
|
||||
temp.cardNumber=list.get(i).getCardNumber() == null ? "" : list.get(i).getCardNumber();
|
||||
temp.flow=list.get(i).getCurFlow()==null ? BigDecimal.valueOf(0) :list.get(i).getCurFlow();
|
||||
temp.startTime=list.get(i).getStartTime()==null ? null : list.get(i).getStartTime();
|
||||
@ -65,7 +68,7 @@ public class UserIrrigationRecordServiceImpl implements IUserIrrigationRecordSer
|
||||
UserIrrigationRecordDto temp=new UserIrrigationRecordDto();
|
||||
temp.id=list.get(i).getId();
|
||||
temp.userName= sysUserMapper.selectUserById(list.get(i).getUserId()).getUserName();
|
||||
temp.deviceName=deviceMapper.selectDeviceBySerialNumber(list.get(i).getDeviceNumber()).getDeviceName();
|
||||
temp.deviceName=ngIrrigationControllersMapper.selectNgIrrigationControllersBySerialNumber(list.get(i).getDeviceNumber()).getControllerName();
|
||||
temp.cardNumber=list.get(i).getCardNumber();
|
||||
temp.flow=list.get(i).getCurFlow();
|
||||
temp.startTime=list.get(i).getStartTime();
|
||||
|
@ -116,7 +116,7 @@ public class UserRechargeCardsServiceImpl implements IUserRechargeCardsService
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
/*@Override
|
||||
public int updateUserRecharge(RechargecardUser rechargecardUser){
|
||||
|
||||
// 根据id查询用户充值卡信息
|
||||
@ -127,34 +127,17 @@ public class UserRechargeCardsServiceImpl implements IUserRechargeCardsService
|
||||
}
|
||||
// 计算新的余额
|
||||
BigDecimal newBalance = rechargecardUser.getNumber().add(info.getBalance());
|
||||
UserConsumptionDetails userConsumptionDetails = UserConsumptionDetails.builder()
|
||||
.userId(info.getUserId())
|
||||
.deviceNumber(null) // 确保业务逻辑可以处理 null 值
|
||||
.cardNumber(info.getCardNumber())
|
||||
.projectId(null) // 确保业务逻辑可以处理 null 值
|
||||
.deptId(null) // 确保业务逻辑可以处理 null 值
|
||||
.billingType(0)
|
||||
.pumpTime(null) // 确保业务逻辑可以处理 null 值
|
||||
.unitPrice(null) // 确保业务逻辑可以处理 null 值
|
||||
.totalPrice(null) // 确保业务逻辑可以处理 null 值
|
||||
.discount(null) // 确保业务逻辑可以处理 null 值
|
||||
.taxAmount(null) // 确保业务逻辑可以处理 null 值
|
||||
.amountDue(rechargecardUser.getNumber())
|
||||
.billingPeriodUnit(null) // 确保业务逻辑可以处理 null 值
|
||||
.billingPeriodDuration(null) // 确保业务逻辑可以处理 null 值
|
||||
.billingDate(DateUtils.getNowDate()) // 获取当前日期
|
||||
.startTime(null) // 确保业务逻辑可以处理 null 值
|
||||
.endTime(null) // 确保业务逻辑可以处理 null 值
|
||||
.paymentStatus(2)
|
||||
.paymentMethod(rechargecardUser.getStatus())
|
||||
.paymentTime(DateUtils.getNowDate()) // 获取当前日期
|
||||
.status(0)
|
||||
.remark(null) // 确保业务逻辑可以处理 null 值
|
||||
.build();
|
||||
UserConsumptionDetails userConsumptionDetails= UserConsumptionDetails.builder()
|
||||
.userId(info.getUserId()).deviceNumber(null).cardNumber(info.getCardNumber())
|
||||
.projectId(null).deptId(null).billingType(0).pumpTime(null).unitPrice(null).totalPrice(null)
|
||||
.discount(null).taxAmount(null).amountDue(rechargecardUser.getNumber()).billingPeriodUnit(null).billingPeriodDuration(null)
|
||||
.billingDate(DateUtils.getNowDate()).startTime(null).endTime(null).paymentStatus(2).paymentMethod(rechargecardUser.getStatus())
|
||||
.paymentTime(DateUtils.getNowDate()).status(0).remark(null);
|
||||
|
||||
userConsumptionDetailsMapper.insertUserConsumptionDetails(userConsumptionDetails);
|
||||
// 更新用户充值卡信息,包括新的余额
|
||||
info.setBalance(newBalance);
|
||||
info.setUpdateTime(DateUtils.getNowDate());
|
||||
return userRechargeCardsMapper.updateUserRechargeCards(info);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
@ -42,6 +42,12 @@
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectNgIrrigationControllersBySerialNumber" parameterType="String" resultMap="NgIrrigationControllersResult">
|
||||
<include refid="selectNgIrrigationControllersVo"/>
|
||||
where serial_number = #{serialNumber}
|
||||
</select>
|
||||
|
||||
<insert id="insertNgIrrigationControllers" parameterType="NgIrrigationControllers" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into ng_irrigation_controllers
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
|
@ -22,10 +22,13 @@
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="deviceNumber" column="device_number" />
|
||||
<result property="projectId" column="project_id" />
|
||||
<result property="deptId" column="dept_id" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectNgUserRechargeRecordsVo">
|
||||
select id, user_id, user_name, card_number, area_code, type, amount, balance, recharge_time, recharge_code, status, serial_number, remark, create_time, update_time, create_by, update_by from ng_user_recharge_records
|
||||
select id, user_id, user_name, card_number, area_code, type, amount, balance, recharge_time, recharge_code, status, serial_number, remark, create_time, update_time, create_by, update_by, device_number, project_id, dept_id from ng_user_recharge_records
|
||||
</sql>
|
||||
|
||||
<select id="selectNgUserRechargeRecordsList" parameterType="NgUserRechargeRecords" resultMap="NgUserRechargeRecordsResult">
|
||||
@ -42,6 +45,9 @@
|
||||
<if test="rechargeCode != null and rechargeCode != ''"> and recharge_code = #{rechargeCode}</if>
|
||||
<if test="status != null "> and status = #{status}</if>
|
||||
<if test="serialNumber != null and serialNumber != ''"> and serial_number = #{serialNumber}</if>
|
||||
<if test="deviceNumber != null and deviceNumber != ''"> and device_number = #{deviceNumber}</if>
|
||||
<if test="projectId != null "> and project_id = #{projectId}</if>
|
||||
<if test="deptId != null "> and dept_id = #{deptId}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
@ -69,6 +75,9 @@
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="deviceNumber != null">device_number,</if>
|
||||
<if test="projectId != null">project_id,</if>
|
||||
<if test="deptId != null">dept_id,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="userId != null">#{userId},</if>
|
||||
@ -87,6 +96,9 @@
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="deviceNumber != null">#{deviceNumber},</if>
|
||||
<if test="projectId != null">#{projectId},</if>
|
||||
<if test="deptId != null">#{deptId},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
@ -109,6 +121,9 @@
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="deviceNumber != null">device_number = #{deviceNumber},</if>
|
||||
<if test="projectId != null">project_id = #{projectId},</if>
|
||||
<if test="deptId != null">dept_id = #{deptId},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
@ -32,10 +32,11 @@
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="areaCode" column="area_code" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectUserConsumptionDetailsVo">
|
||||
select id, user_id, device_number, card_number, project_id, dept_id, billing_type, pump_time, unit_price, total_price, discount, tax_amount, amount_due, billing_period_unit, billing_period_duration, billing_date, start_time, end_time, payment_status, payment_method, payment_time, status, remark, create_time, update_time, create_by, update_by from user_consumption_details
|
||||
select id, user_id, device_number, card_number, project_id, dept_id, billing_type, pump_time, unit_price, total_price, discount, tax_amount, amount_due, billing_period_unit, billing_period_duration, billing_date, start_time, end_time, payment_status, payment_method, payment_time, status, remark, create_time, update_time, create_by, update_by, area_code from user_consumption_details
|
||||
</sql>
|
||||
|
||||
<select id="selectUserConsumptionDetailsList" parameterType="UserConsumptionDetails" resultMap="UserConsumptionDetailsResult">
|
||||
@ -62,7 +63,7 @@
|
||||
<if test="paymentMethod != null "> and payment_method = #{paymentMethod}</if>
|
||||
<if test="paymentTime != null "> and payment_time = #{paymentTime}</if>
|
||||
<if test="status != null "> and status = #{status}</if>
|
||||
<if test="remark != null and remark != ''"> and remark = #{remark}</if>
|
||||
<if test="areaCode != null and areaCode != ''"> and area_code = #{areaCode}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
@ -73,9 +74,7 @@
|
||||
|
||||
<select id="selectUserConsumptionDetailsListById" parameterType="String" resultMap="UserConsumptionDetailsResult">
|
||||
<include refid="selectUserConsumptionDetailsVo"/>
|
||||
<where>
|
||||
card_number=#{cardNumber}
|
||||
</where>
|
||||
where card_number = #{cardNumber}
|
||||
</select>
|
||||
|
||||
<insert id="insertUserConsumptionDetails" parameterType="UserConsumptionDetails" useGeneratedKeys="true" keyProperty="id">
|
||||
@ -107,6 +106,7 @@
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="areaCode != null">area_code,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="userId != null">#{userId},</if>
|
||||
@ -135,6 +135,7 @@
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="areaCode != null">#{areaCode},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
@ -167,6 +168,7 @@
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="areaCode != null">area_code = #{areaCode},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
@ -58,6 +58,10 @@
|
||||
<include refid="selectUserRechargeCardsVo"/>
|
||||
where card_number= #{cardnumber}
|
||||
</select>
|
||||
<select id="selectUserRechargeCardsByCardNumber" parameterType="String" resultMap="UserRechargeCardsResult">
|
||||
<include refid="selectUserRechargeCardsVo"/>
|
||||
where cardNumber = #{cardNumber}
|
||||
</select>
|
||||
|
||||
<insert id="insertUserRechargeCards" parameterType="UserRechargeCards" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into user_recharge_cards
|
||||
@ -129,7 +133,7 @@
|
||||
</update>
|
||||
|
||||
<delete id="deleteUserRechargeCardsById" parameterType="Long">
|
||||
delete from user_recharge_cards where user_id = #{id}
|
||||
delete from user_recharge_cards where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteUserRechargeCardsByIds" parameterType="String">
|
||||
|
Loading…
x
Reference in New Issue
Block a user