用户绑定仪器模块开发

master
elliott 2 years ago
parent f7ba814037
commit ee58e54a2f

@ -0,0 +1,124 @@
package com.flossom.common.core.domain.entity;
import com.flossom.common.core.annotation.Excel;
import com.flossom.common.core.web.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* wx_instrument_serial
*
* @author flossom
* @date 2024-01-10
*/
public class WxInstrumentSerial extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** $column.columnComment */
private Long id;
/** 仪器id */
@Excel(name = "仪器id")
private Long instrumentId;
/** 仪器名称 */
@Excel(name = "仪器名称")
private String instrumentName;
/** 序列号 */
@Excel(name = "序列号")
private String serial;
/** 绑定状态1未绑定2已解绑 */
@Excel(name = "绑定状态0已经绑定1未绑定2已解绑")
private Integer bindingStatus;
/** 序列号有效状态1有效0无效 */
@Excel(name = "序列号有效状态1有效0无效")
private Integer validStatus;
/** 状态0正常 1停用 */
@Excel(name = "状态", readConverterExp = "0=正常,1=停用")
private Long status;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setInstrumentId(Long instrumentId)
{
this.instrumentId = instrumentId;
}
public Long getInstrumentId()
{
return instrumentId;
}
public void setInstrumentName(String instrumentName)
{
this.instrumentName = instrumentName;
}
public String getInstrumentName()
{
return instrumentName;
}
public void setSerial(String serial)
{
this.serial = serial;
}
public String getSerial()
{
return serial;
}
public void setBindingStatus(Integer bindingStatus)
{
this.bindingStatus = bindingStatus;
}
public Integer getBindingStatus()
{
return bindingStatus;
}
public void setValidStatus(Integer validStatus)
{
this.validStatus = validStatus;
}
public Integer getValidStatus()
{
return validStatus;
}
public void setStatus(Long status)
{
this.status = status;
}
public Long getStatus()
{
return status;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("instrumentId", getInstrumentId())
.append("instrumentName", getInstrumentName())
.append("serial", getSerial())
.append("bindingStatus", getBindingStatus())
.append("validStatus", getValidStatus())
.append("status", getStatus())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("remark", getRemark())
.toString();
}
}

@ -0,0 +1,306 @@
package com.flossom.common.core.domain.entity;
import java.util.Date;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.flossom.common.core.annotation.Excel;
import com.flossom.common.core.web.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* wx_user_instrument
*
* @author flossom
* @date 2024-01-10
*/
public class WxUserInstrument extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** $column.columnComment */
private Long id;
/** 用户id */
@Excel(name = "用户id")
private Long userId;
/** 序列号 */
@Excel(name = "序列号")
private String serial;
/** 仪器id */
@Excel(name = "仪器id")
private Long instrumentId;
/** 仪器名称 */
@Excel(name = "仪器名称")
private String instrumentName;
/** 序列号图片 */
@Excel(name = "序列号图片")
private String serialImage;
/** 保修日期 */
@Excel(name = "保修日期")
private Long guarantee;
/** 保修到期时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "保修到期时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date guaranteeEndtime;
/** 绑定状态1未绑定2已解绑 */
@Excel(name = "绑定状态1未绑定2已解绑0-已绑定")
private Integer bindingStatus;
/** 状态0正常 1停用 */
@Excel(name = "状态", readConverterExp = "0=正常,1=停用")
private Long status;
// 仪器实体
private WxInstrument wxInstrument;
// 微信用户实体
private WxUserMember wxUserMember;
// 查询用户ID 格式为xxx,xxx,xxx
private String userIds;
private List<Long> userIdArray;
// 用户手机
private String userPhone;
// 查询仪器id集合
private String instrumentIds;
// 仪器集合名称集合
private List<String> instrumentIdArray;
// 状态集合
private List<String> bindingStatusArray;
// 查询用的昵称
private String nickName;
// 查询的绑定状态
private List<String> bindStatusQuery;
private String mapperBindStatus;
private String startTime;
private String endTime;
public List<Long> getUserIdArray() {
return userIdArray;
}
public void setUserIdArray(List<Long> userIdArray) {
this.userIdArray = userIdArray;
}
public String getStartTime() {
return startTime;
}
public void setStartTime(String startTime) {
this.startTime = startTime;
}
public String getEndTime() {
return endTime;
}
public void setEndTime(String endTime) {
this.endTime = endTime;
}
public String getUserIds() {
return userIds;
}
public void setUserIds(String userIds) {
this.userIds = userIds;
}
public String getUserPhone() {
return userPhone;
}
public void setUserPhone(String userPhone) {
this.userPhone = userPhone;
}
public String getInstrumentIds() {
return instrumentIds;
}
public void setInstrumentIds(String instrumentIds) {
this.instrumentIds = instrumentIds;
}
public List<String> getInstrumentIdArray() {
return instrumentIdArray;
}
public void setInstrumentIdArray(List<String> instrumentIdArray) {
this.instrumentIdArray = instrumentIdArray;
}
public List<String> getBindingStatusArray() {
return bindingStatusArray;
}
public void setBindingStatusArray(List<String> bindingStatusArray) {
this.bindingStatusArray = bindingStatusArray;
}
public String getNickName() {
return nickName;
}
public void setNickName(String nickName) {
this.nickName = nickName;
}
public String getMapperBindStatus() {
return mapperBindStatus;
}
public void setMapperBindStatus(String mapperBindStatus) {
this.mapperBindStatus = mapperBindStatus;
}
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setUserId(Long userId)
{
this.userId = userId;
}
public Long getUserId()
{
return userId;
}
public void setSerial(String serial)
{
this.serial = serial;
}
public String getSerial()
{
return serial;
}
public void setInstrumentId(Long instrumentId)
{
this.instrumentId = instrumentId;
}
public Long getInstrumentId()
{
return instrumentId;
}
public void setInstrumentName(String instrumentName)
{
this.instrumentName = instrumentName;
}
public String getInstrumentName()
{
return instrumentName;
}
public void setSerialImage(String serialImage)
{
this.serialImage = serialImage;
}
public String getSerialImage()
{
return serialImage;
}
public void setGuarantee(Long guarantee)
{
this.guarantee = guarantee;
}
public Long getGuarantee()
{
return guarantee;
}
public void setGuaranteeEndtime(Date guaranteeEndtime)
{
this.guaranteeEndtime = guaranteeEndtime;
}
public Date getGuaranteeEndtime()
{
return guaranteeEndtime;
}
public void setBindingStatus(Integer bindingStatus)
{
this.bindingStatus = bindingStatus;
}
public Integer getBindingStatus()
{
return bindingStatus;
}
public void setStatus(Long status)
{
this.status = status;
}
public Long getStatus()
{
return status;
}
public WxInstrument getWxInstrument() {
return wxInstrument;
}
public void setWxInstrument(WxInstrument wxInstrument) {
this.wxInstrument = wxInstrument;
}
public WxUserMember getWxUserMember() {
return wxUserMember;
}
public void setWxUserMember(WxUserMember wxUserMember) {
this.wxUserMember = wxUserMember;
}
public List<String> getBindStatusQuery() {
return bindStatusQuery;
}
public void setBindStatusQuery(List<String> bindStatusQuery) {
this.bindStatusQuery = bindStatusQuery;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("userId", getUserId())
.append("serial", getSerial())
.append("instrumentId", getInstrumentId())
.append("instrumentName", getInstrumentName())
.append("serialImage", getSerialImage())
.append("guarantee", getGuarantee())
.append("guaranteeEndtime", getGuaranteeEndtime())
.append("bindingStatus", getBindingStatus())
.append("status", getStatus())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.toString();
}
}

@ -0,0 +1,179 @@
package com.flossom.common.core.domain.entity;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.flossom.common.core.annotation.Excel;
import com.flossom.common.core.web.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* wx_user_instrument_log
*
* @author flossom
* @date 2024-01-10
*/
public class WxUserInstrumentLog extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** $column.columnComment */
private Long id;
/** 关联绑定ID */
private Long userInstrumentId;
/** 用户id */
@Excel(name = "用户id")
private Long userId;
/** 序列号 */
@Excel(name = "序列号")
private String serial;
/** 仪器id */
@Excel(name = "仪器id")
private Long instrumentId;
/** 仪器名称 */
@Excel(name = "仪器名称")
private String instrumentName;
/** 序列号图片 */
@Excel(name = "序列号图片")
private String serialImage;
/** 保修日期 */
@Excel(name = "保修日期")
private Long guarantee;
/** 保修到期时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "保修到期时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date guaranteeEndtime;
/** 绑定状态1未绑定2已解绑 */
@Excel(name = "绑定状态1未绑定2已解绑,0-已绑定")
private Integer bindingStatus;
/** 状态0正常 1停用 */
@Excel(name = "状态", readConverterExp = "0=正常,1=停用")
private Long status;
public Long getUserInstrumentId() {
return userInstrumentId;
}
public void setUserInstrumentId(Long userInstrumentId) {
this.userInstrumentId = userInstrumentId;
}
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setUserId(Long userId)
{
this.userId = userId;
}
public Long getUserId()
{
return userId;
}
public void setSerial(String serial)
{
this.serial = serial;
}
public String getSerial()
{
return serial;
}
public void setInstrumentId(Long instrumentId)
{
this.instrumentId = instrumentId;
}
public Long getInstrumentId()
{
return instrumentId;
}
public void setInstrumentName(String instrumentName)
{
this.instrumentName = instrumentName;
}
public String getInstrumentName()
{
return instrumentName;
}
public void setSerialImage(String serialImage)
{
this.serialImage = serialImage;
}
public String getSerialImage()
{
return serialImage;
}
public void setGuarantee(Long guarantee)
{
this.guarantee = guarantee;
}
public Long getGuarantee()
{
return guarantee;
}
public void setGuaranteeEndtime(Date guaranteeEndtime)
{
this.guaranteeEndtime = guaranteeEndtime;
}
public Date getGuaranteeEndtime()
{
return guaranteeEndtime;
}
public void setBindingStatus(Integer bindingStatus)
{
this.bindingStatus = bindingStatus;
}
public Integer getBindingStatus()
{
return bindingStatus;
}
public void setStatus(Long status)
{
this.status = status;
}
public Long getStatus()
{
return status;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("userId", getUserId())
.append("serial", getSerial())
.append("instrumentId", getInstrumentId())
.append("instrumentName", getInstrumentName())
.append("serialImage", getSerialImage())
.append("guarantee", getGuarantee())
.append("guaranteeEndtime", getGuaranteeEndtime())
.append("bindingStatus", getBindingStatus())
.append("status", getStatus())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.toString();
}
}

@ -0,0 +1,62 @@
package com.flossom.common.core.mapper;
import com.flossom.common.core.domain.entity.WxInstrumentSerial;
import java.util.List;
/**
* Mapper
*
* @author flossom
* @date 2024-01-10
*/
public interface WxInstrumentSerialMapper
{
/**
*
*
* @param id
* @return
*/
public WxInstrumentSerial selectWxInstrumentSerialById(Long id);
/**
*
*
* @param wxInstrumentSerial
* @return
*/
public List<WxInstrumentSerial> selectWxInstrumentSerialList(WxInstrumentSerial wxInstrumentSerial);
/**
*
*
* @param wxInstrumentSerial
* @return
*/
public int insertWxInstrumentSerial(WxInstrumentSerial wxInstrumentSerial);
/**
*
*
* @param wxInstrumentSerial
* @return
*/
public int updateWxInstrumentSerial(WxInstrumentSerial wxInstrumentSerial);
/**
*
*
* @param id
* @return
*/
public int deleteWxInstrumentSerialById(Long id);
/**
*
*
* @param ids
* @return
*/
public int deleteWxInstrumentSerialByIds(Long[] ids);
}

@ -0,0 +1,62 @@
package com.flossom.common.core.mapper;
import com.flossom.common.core.domain.entity.WxUserInstrumentLog;
import java.util.List;
/**
* Mapper
*
* @author flossom
* @date 2024-01-10
*/
public interface WxUserInstrumentLogMapper
{
/**
*
*
* @param id
* @return
*/
public WxUserInstrumentLog selectWxUserInstrumentLogById(Long id);
/**
*
*
* @param wxUserInstrumentLog
* @return
*/
public List<WxUserInstrumentLog> selectWxUserInstrumentLogList(WxUserInstrumentLog wxUserInstrumentLog);
/**
*
*
* @param wxUserInstrumentLog
* @return
*/
public int insertWxUserInstrumentLog(WxUserInstrumentLog wxUserInstrumentLog);
/**
*
*
* @param wxUserInstrumentLog
* @return
*/
public int updateWxUserInstrumentLog(WxUserInstrumentLog wxUserInstrumentLog);
/**
*
*
* @param id
* @return
*/
public int deleteWxUserInstrumentLogById(Long id);
/**
*
*
* @param ids
* @return
*/
public int deleteWxUserInstrumentLogByIds(Long[] ids);
}

@ -0,0 +1,62 @@
package com.flossom.common.core.mapper;
import com.flossom.common.core.domain.entity.WxUserInstrument;
import java.util.List;
/**
* Mapper
*
* @author flossom
* @date 2024-01-10
*/
public interface WxUserInstrumentMapper
{
/**
*
*
* @param id
* @return
*/
public WxUserInstrument selectWxUserInstrumentById(Long id);
/**
*
*
* @param wxUserInstrument
* @return
*/
public List<WxUserInstrument> selectWxUserInstrumentList(WxUserInstrument wxUserInstrument);
/**
*
*
* @param wxUserInstrument
* @return
*/
public int insertWxUserInstrument(WxUserInstrument wxUserInstrument);
/**
*
*
* @param wxUserInstrument
* @return
*/
public int updateWxUserInstrument(WxUserInstrument wxUserInstrument);
/**
*
*
* @param id
* @return
*/
public int deleteWxUserInstrumentById(Long id);
/**
*
*
* @param ids
* @return
*/
public int deleteWxUserInstrumentByIds(Long[] ids);
}

@ -0,0 +1,93 @@
<?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.flossom.common.core.mapper.WxInstrumentSerialMapper">
<resultMap type="WxInstrumentSerial" id="WxInstrumentSerialResult">
<result property="id" column="id" />
<result property="instrumentId" column="instrument_id" />
<result property="instrumentName" column="instrument_name" />
<result property="serial" column="serial" />
<result property="bindingStatus" column="binding_status" />
<result property="validStatus" column="valid_status" />
<result property="status" column="status" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="remark" column="remark" />
</resultMap>
<sql id="selectWxInstrumentSerialVo">
select id, instrument_id, instrument_name, serial, binding_status, valid_status, status, create_by, create_time, remark from wx_instrument_serial
</sql>
<select id="selectWxInstrumentSerialList" parameterType="WxInstrumentSerial" resultMap="WxInstrumentSerialResult">
<include refid="selectWxInstrumentSerialVo"/>
<where>
<if test="instrumentId != null "> and instrument_id = #{instrumentId}</if>
<if test="instrumentName != null and instrumentName != ''"> and instrument_name like concat('%', #{instrumentName}, '%')</if>
<if test="serial != null and serial != ''"> and serial = #{serial}</if>
<if test="bindingStatus != null "> and binding_status = #{bindingStatus}</if>
<if test="validStatus != null "> and valid_status = #{validStatus}</if>
<if test="status != null "> and status = #{status}</if>
</where>
</select>
<select id="selectWxInstrumentSerialById" parameterType="Long" resultMap="WxInstrumentSerialResult">
<include refid="selectWxInstrumentSerialVo"/>
where id = #{id}
</select>
<insert id="insertWxInstrumentSerial" parameterType="WxInstrumentSerial" useGeneratedKeys="true" keyProperty="id">
insert into wx_instrument_serial
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="instrumentId != null">instrument_id,</if>
<if test="instrumentName != null and instrumentName != ''">instrument_name,</if>
<if test="serial != null and serial != ''">serial,</if>
<if test="bindingStatus != null">binding_status,</if>
<if test="validStatus != null">valid_status,</if>
<if test="status != null">status,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="instrumentId != null">#{instrumentId},</if>
<if test="instrumentName != null and instrumentName != ''">#{instrumentName},</if>
<if test="serial != null and serial != ''">#{serial},</if>
<if test="bindingStatus != null">#{bindingStatus},</if>
<if test="validStatus != null">#{validStatus},</if>
<if test="status != null">#{status},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="remark != null">#{remark},</if>
</trim>
</insert>
<update id="updateWxInstrumentSerial" parameterType="WxInstrumentSerial">
update wx_instrument_serial
<trim prefix="SET" suffixOverrides=",">
<if test="instrumentId != null">instrument_id = #{instrumentId},</if>
<if test="instrumentName != null and instrumentName != ''">instrument_name = #{instrumentName},</if>
<if test="serial != null and serial != ''">serial = #{serial},</if>
<if test="bindingStatus != null">binding_status = #{bindingStatus},</if>
<if test="validStatus != null">valid_status = #{validStatus},</if>
<if test="status != null">status = #{status},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="remark != null">remark = #{remark},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteWxInstrumentSerialById" parameterType="Long">
delete from wx_instrument_serial where id = #{id}
</delete>
<delete id="deleteWxInstrumentSerialByIds" parameterType="String">
delete from wx_instrument_serial where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

@ -0,0 +1,110 @@
<?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.flossom.common.core.mapper.WxUserInstrumentLogMapper">
<resultMap type="WxUserInstrumentLog" id="WxUserInstrumentLogResult">
<result property="id" column="id" />
<result property="userInstrumentId" column="user_instrument_id" />
<result property="userId" column="user_id" />
<result property="serial" column="serial" />
<result property="instrumentId" column="instrument_id" />
<result property="instrumentName" column="instrument_name" />
<result property="serialImage" column="serial_image" />
<result property="guarantee" column="guarantee" />
<result property="guaranteeEndtime" column="guarantee_endtime" />
<result property="bindingStatus" column="binding_status" />
<result property="status" column="status" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
</resultMap>
<sql id="selectWxUserInstrumentLogVo">
select id, user_id, serial, instrument_id, instrument_name, serial_image, guarantee, guarantee_endtime, binding_status, status, create_by, create_time from wx_user_instrument_log
</sql>
<select id="selectWxUserInstrumentLogList" parameterType="WxUserInstrumentLog" resultMap="WxUserInstrumentLogResult">
<include refid="selectWxUserInstrumentLogVo"/>
<where>
<if test="userInstrumentId != null "> and user_instrument_id = #{userInstrumentId}</if>
<if test="userId != null "> and user_id = #{userId}</if>
<if test="serial != null and serial != ''"> and serial = #{serial}</if>
<if test="instrumentId != null "> and instrument_id = #{instrumentId}</if>
<if test="instrumentName != null and instrumentName != ''"> and instrument_name like concat('%', #{instrumentName}, '%')</if>
<if test="serialImage != null and serialImage != ''"> and serial_image = #{serialImage}</if>
<if test="guarantee != null "> and guarantee = #{guarantee}</if>
<if test="guaranteeEndtime != null "> and guarantee_endtime = #{guaranteeEndtime}</if>
<if test="bindingStatus != null "> and binding_status = #{bindingStatus}</if>
<if test="status != null "> and status = #{status}</if>
</where>
order by create_time desc
</select>
<select id="selectWxUserInstrumentLogById" parameterType="Long" resultMap="WxUserInstrumentLogResult">
<include refid="selectWxUserInstrumentLogVo"/>
where id = #{id}
</select>
<insert id="insertWxUserInstrumentLog" parameterType="WxUserInstrumentLog" useGeneratedKeys="true" keyProperty="id">
insert into wx_user_instrument_log
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="userInstrumentId != null">user_instrument_id,</if>
<if test="userId != null">user_id,</if>
<if test="serial != null and serial != ''">serial,</if>
<if test="instrumentId != null">instrument_id,</if>
<if test="instrumentName != null and instrumentName != ''">instrument_name,</if>
<if test="serialImage != null and serialImage != ''">serial_image,</if>
<if test="guarantee != null">guarantee,</if>
<if test="guaranteeEndtime != null">guarantee_endtime,</if>
<if test="bindingStatus != null">binding_status,</if>
<if test="status != null">status,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="userInstrumentId != null">#{userInstrumentId},</if>
<if test="userId != null">#{userId},</if>
<if test="serial != null and serial != ''">#{serial},</if>
<if test="instrumentId != null">#{instrumentId},</if>
<if test="instrumentName != null and instrumentName != ''">#{instrumentName},</if>
<if test="serialImage != null and serialImage != ''">#{serialImage},</if>
<if test="guarantee != null">#{guarantee},</if>
<if test="guaranteeEndtime != null">#{guaranteeEndtime},</if>
<if test="bindingStatus != null">#{bindingStatus},</if>
<if test="status != null">#{status},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
</trim>
</insert>
<update id="updateWxUserInstrumentLog" parameterType="WxUserInstrumentLog">
update wx_user_instrument_log
<trim prefix="SET" suffixOverrides=",">
<if test="userInstrumentId != null">user_instrument_id = #{userInstrumentId},</if>
<if test="userId != null">user_id = #{userId},</if>
<if test="serial != null and serial != ''">serial = #{serial},</if>
<if test="instrumentId != null">instrument_id = #{instrumentId},</if>
<if test="instrumentName != null and instrumentName != ''">instrument_name = #{instrumentName},</if>
<if test="serialImage != null and serialImage != ''">serial_image = #{serialImage},</if>
<if test="guarantee != null">guarantee = #{guarantee},</if>
<if test="guaranteeEndtime != null">guarantee_endtime = #{guaranteeEndtime},</if>
<if test="bindingStatus != null">binding_status = #{bindingStatus},</if>
<if test="status != null">status = #{status},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteWxUserInstrumentLogById" parameterType="Long">
delete from wx_user_instrument_log where id = #{id}
</delete>
<delete id="deleteWxUserInstrumentLogByIds" parameterType="String">
delete from wx_user_instrument_log where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

@ -0,0 +1,144 @@
<?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.flossom.common.core.mapper.WxUserInstrumentMapper">
<resultMap type="WxUserInstrument" id="WxUserInstrumentResult">
<result property="id" column="id" />
<result property="userId" column="user_id" />
<result property="serial" column="serial" />
<result property="instrumentId" column="instrument_id" />
<result property="instrumentName" column="instrument_name" />
<result property="serialImage" column="serial_image" />
<result property="guarantee" column="guarantee" />
<result property="guaranteeEndtime" column="guarantee_endtime" />
<result property="bindingStatus" column="binding_status" />
<result property="status" column="status" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
</resultMap>
<sql id="selectWxUserInstrumentVo">
select id, user_id, serial, instrument_id, instrument_name, serial_image, guarantee, guarantee_endtime, binding_status, status, create_by, create_time, update_by, update_time, remark from wx_user_instrument
</sql>
<select id="selectWxUserInstrumentList" parameterType="WxUserInstrument" resultMap="WxUserInstrumentResult">
<include refid="selectWxUserInstrumentVo"/>
<where>
<if test="userId != null "> and user_id = #{userId}</if>
<if test="serial != null and serial != ''"> and serial like concat('%', #{serial}, '%')</if>
<if test="instrumentId != null "> and instrument_id like concat('%', #{instrumentId}, '%')</if>
<if test="instrumentName != null and instrumentName != ''"> and instrument_name like concat('%', #{instrumentName}, '%')</if>
<if test="serialImage != null and serialImage != ''"> and serial_image = #{serialImage}</if>
<if test="guarantee != null "> and guarantee = #{guarantee}</if>
<if test="guaranteeEndtime != null "> and guarantee_endtime = #{guaranteeEndtime}</if>
<if test="bindingStatus != null "> and binding_status = #{bindingStatus}</if>
<if test="status != null "> and status = #{status}</if>
</where>
order by create_time desc
</select>
<select id="selectWxUserInstrumentById" parameterType="Long" resultMap="WxUserInstrumentResult">
<include refid="selectWxUserInstrumentVo"/>
where id = #{id}
</select>
<insert id="insertWxUserInstrument" parameterType="WxUserInstrument" useGeneratedKeys="true" keyProperty="id">
insert into wx_user_instrument
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="userId != null">user_id,</if>
<if test="serial != null and serial != ''">serial,</if>
<if test="instrumentId != null">instrument_id,</if>
<if test="instrumentName != null and instrumentName != ''">instrument_name,</if>
<if test="serialImage != null and serialImage != ''">serial_image,</if>
<if test="guarantee != null">guarantee,</if>
<if test="guaranteeEndtime != null">guarantee_endtime,</if>
<if test="bindingStatus != null">binding_status,</if>
<if test="status != null">status,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="userId != null">#{userId},</if>
<if test="serial != null and serial != ''">#{serial},</if>
<if test="instrumentId != null">#{instrumentId},</if>
<if test="instrumentName != null and instrumentName != ''">#{instrumentName},</if>
<if test="serialImage != null and serialImage != ''">#{serialImage},</if>
<if test="guarantee != null">#{guarantee},</if>
<if test="guaranteeEndtime != null">#{guaranteeEndtime},</if>
<if test="bindingStatus != null">#{bindingStatus},</if>
<if test="status != null">#{status},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
</trim>
</insert>
<update id="updateWxUserInstrument" parameterType="WxUserInstrument">
update wx_user_instrument
<trim prefix="SET" suffixOverrides=",">
<if test="userId != null">user_id = #{userId},</if>
<if test="serial != null and serial != ''">serial = #{serial},</if>
<if test="instrumentId != null">instrument_id = #{instrumentId},</if>
<if test="instrumentName != null and instrumentName != ''">instrument_name = #{instrumentName},</if>
<if test="serialImage != null and serialImage != ''">serial_image = #{serialImage},</if>
<if test="guarantee != null">guarantee = #{guarantee},</if>
<if test="guaranteeEndtime != null">guarantee_endtime = #{guaranteeEndtime},</if>
<if test="bindingStatus != null">binding_status = #{bindingStatus},</if>
<if test="status != null">status = #{status},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="userIds!=null and userIds !=''">
and
<foreach collection="userIds.split(',')" index="index" item="item" open="(" separator="OR"
close=")">
user_id = #{item}
</foreach>
</if>
<if test="instrumentIds!=null and instrumentIds !=''">
and
<foreach collection="instrumentIds.split(',')" index="index" item="item" open="(" separator="OR"
close=")">
instrument_id = #{item}
</foreach>
</if>
<if test="mapperBindStatus!=null and mapperBindStatus !=''">
and
<foreach collection="mapperBindStatus.split(',')" index="index" item="item" open="(" separator="OR"
close=")">
binding_status = #{item}
</foreach>
</if>
<if test="startTime != null and startTime != ''">
and create_time &gt;= #{startTime}
</if>
<if test="endTime != null and endTime != ''">
and create_time &lt;= #{endTime}
</if>
</trim>
where id = #{id}
</update>
<delete id="deleteWxUserInstrumentById" parameterType="Long">
delete from wx_user_instrument where id = #{id}
</delete>
<delete id="deleteWxUserInstrumentByIds" parameterType="String">
delete from wx_user_instrument where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

@ -0,0 +1,106 @@
package com.flossom.system.controller;
import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import com.flossom.common.core.domain.entity.WxInstrumentSerial;
import com.flossom.common.core.utils.poi.ExcelUtil;
import com.flossom.common.core.web.controller.BaseController;
import com.flossom.common.core.web.domain.AjaxResult;
import com.flossom.common.core.web.page.TableDataInfo;
import com.flossom.common.log.annotation.Log;
import com.flossom.common.log.enums.BusinessType;
import com.flossom.common.security.annotation.RequiresPermissions;
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.flossom.system.service.IWxInstrumentSerialService;
/**
* Controller
*
* @author flossom
* @date 2024-01-10
*/
@RestController
@RequestMapping("/serial")
public class WxInstrumentSerialController extends BaseController
{
@Autowired
private IWxInstrumentSerialService wxInstrumentSerialService;
/**
*
*/
@RequiresPermissions("system:serial:list")
@GetMapping("/list")
public TableDataInfo list(WxInstrumentSerial wxInstrumentSerial)
{
startPage();
List<WxInstrumentSerial> list = wxInstrumentSerialService.selectWxInstrumentSerialList(wxInstrumentSerial);
return getDataTable(list);
}
/**
*
*/
@RequiresPermissions("system:serial:export")
@Log(title = "仪器序列号关联", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, WxInstrumentSerial wxInstrumentSerial)
{
List<WxInstrumentSerial> list = wxInstrumentSerialService.selectWxInstrumentSerialList(wxInstrumentSerial);
ExcelUtil<WxInstrumentSerial> util = new ExcelUtil<WxInstrumentSerial>(WxInstrumentSerial.class);
util.exportExcel(response, list, "仪器序列号关联数据");
}
/**
*
*/
@RequiresPermissions("system:serial:query")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(wxInstrumentSerialService.selectWxInstrumentSerialById(id));
}
/**
*
*/
@RequiresPermissions("system:serial:add")
@Log(title = "仪器序列号关联", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody WxInstrumentSerial wxInstrumentSerial)
{
return toAjax(wxInstrumentSerialService.insertWxInstrumentSerial(wxInstrumentSerial));
}
/**
*
*/
@RequiresPermissions("system:serial:edit")
@Log(title = "仪器序列号关联", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody WxInstrumentSerial wxInstrumentSerial)
{
return toAjax(wxInstrumentSerialService.updateWxInstrumentSerial(wxInstrumentSerial));
}
/**
*
*/
@RequiresPermissions("system:serial:remove")
@Log(title = "仪器序列号关联", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(wxInstrumentSerialService.deleteWxInstrumentSerialByIds(ids));
}
}

@ -0,0 +1,151 @@
package com.flossom.system.controller;
import java.util.List;
import java.io.IOException;
import java.util.Map;
import java.util.Objects;
import javax.servlet.http.HttpServletResponse;
import com.flossom.common.core.domain.entity.WxInstrument;
import com.flossom.common.core.domain.entity.WxUserInstrument;
import com.flossom.common.core.domain.entity.WxUserMember;
import com.flossom.common.core.domain.vo.WxUserMemberVo;
import com.flossom.common.core.utils.poi.ExcelUtil;
import com.flossom.common.core.web.controller.BaseController;
import com.flossom.common.core.web.domain.AjaxResult;
import com.flossom.common.core.web.page.TableDataInfo;
import com.flossom.common.log.annotation.Log;
import com.flossom.common.log.enums.BusinessType;
import com.flossom.common.security.annotation.RequiresPermissions;
import com.flossom.system.service.IWxInstrumentService;
import com.flossom.system.service.IWxUserMemberService;
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.flossom.system.service.IWxUserInstrumentService;
/**
* Controller
*
* @author flossom
* @date 2024-01-10
*/
@RestController
@RequestMapping("/userInstrument")
public class WxUserInstrumentController extends BaseController
{
@Autowired
private IWxUserInstrumentService wxUserInstrumentService;
@Autowired
private IWxUserMemberService wxUserMemberService;
@Autowired
private IWxInstrumentService wxInstrumentService;
/**
*
*/
@RequiresPermissions("system:userInstrument:list")
@GetMapping("/list")
public TableDataInfo list(WxUserInstrument wxUserInstrument)
{
startPage();
List<WxUserInstrument> list = wxUserInstrumentService.selectWxUserInstrumentList(wxUserInstrument);
//循环查询对应的信息
for (WxUserInstrument userInstrument: list) {
if (Objects.nonNull(userInstrument.getInstrumentId())) {
WxInstrument wxInstrument = wxInstrumentService.selectWxInstrumentById(userInstrument.getInstrumentId());
userInstrument.setWxInstrument(wxInstrument);
}
if (Objects.nonNull(userInstrument.getUserId())) {
WxUserMember wxUserMember = wxUserMemberService.selectWxUserMemberByIdInit(userInstrument.getUserId());
userInstrument.setWxUserMember(wxUserMember);
}
}
return getDataTable(list);
}
/**
*
*/
@RequiresPermissions("system:userInstrument:export")
@Log(title = "用户仪器绑定", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, WxUserInstrument wxUserInstrument)
{
List<WxUserInstrument> list = wxUserInstrumentService.selectWxUserInstrumentList(wxUserInstrument);
ExcelUtil<WxUserInstrument> util = new ExcelUtil<WxUserInstrument>(WxUserInstrument.class);
util.exportExcel(response, list, "用户仪器绑定数据");
}
/**
*
*/
@RequiresPermissions("system:userInstrument:query")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(wxUserInstrumentService.selectWxUserInstrumentById(id));
}
/**
*
*/
@RequiresPermissions("system:userInstrument:add")
@Log(title = "用户仪器绑定", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody WxUserInstrument wxUserInstrument)
{
return toAjax(wxUserInstrumentService.insertWxUserInstrument(wxUserInstrument));
}
/**
*
*/
@RequiresPermissions("system:userInstrument:edit")
@Log(title = "用户仪器绑定", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody WxUserInstrument wxUserInstrument)
{
return toAjax(wxUserInstrumentService.updateWxUserInstrument(wxUserInstrument));
}
/**
*
*/
@RequiresPermissions("system:userInstrument:remove")
@Log(title = "用户仪器绑定", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(wxUserInstrumentService.deleteWxUserInstrumentByIds(ids));
}
/**
*
*/
@Log(title = "用户仪器更换序列号", businessType = BusinessType.UPDATE)
@PutMapping("/changeSerial")
public AjaxResult changeSerial(@RequestBody WxUserInstrument wxUserInstrument)
{
Map<String, String> stringStringMap = wxUserInstrumentService.changeSerial(wxUserInstrument);
return AjaxResult.success(stringStringMap);
}
/**
*
*/
@Log(title = "更换序列号", businessType = BusinessType.UPDATE)
@PutMapping("/changeGuarantee")
public AjaxResult changeGuarantee(@RequestBody WxUserInstrument wxUserInstrument)
{
return toAjax(wxUserInstrumentService.changeGuarantee(wxUserInstrument));
}
}

@ -0,0 +1,106 @@
package com.flossom.system.controller;
import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import com.flossom.common.core.domain.entity.WxUserInstrumentLog;
import com.flossom.common.core.utils.poi.ExcelUtil;
import com.flossom.common.core.web.controller.BaseController;
import com.flossom.common.core.web.domain.AjaxResult;
import com.flossom.common.core.web.page.TableDataInfo;
import com.flossom.common.log.annotation.Log;
import com.flossom.common.log.enums.BusinessType;
import com.flossom.common.security.annotation.RequiresPermissions;
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.flossom.system.service.IWxUserInstrumentLogService;
/**
* Controller
*
* @author flossom
* @date 2024-01-10
*/
@RestController
@RequestMapping("/log")
public class WxUserInstrumentLogController extends BaseController
{
@Autowired
private IWxUserInstrumentLogService wxUserInstrumentLogService;
/**
*
*/
@RequiresPermissions("system:log:list")
@GetMapping("/list")
public TableDataInfo list(WxUserInstrumentLog wxUserInstrumentLog)
{
startPage();
List<WxUserInstrumentLog> list = wxUserInstrumentLogService.selectWxUserInstrumentLogList(wxUserInstrumentLog);
return getDataTable(list);
}
/**
*
*/
@RequiresPermissions("system:log:export")
@Log(title = "用户仪器绑定日志", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, WxUserInstrumentLog wxUserInstrumentLog)
{
List<WxUserInstrumentLog> list = wxUserInstrumentLogService.selectWxUserInstrumentLogList(wxUserInstrumentLog);
ExcelUtil<WxUserInstrumentLog> util = new ExcelUtil<WxUserInstrumentLog>(WxUserInstrumentLog.class);
util.exportExcel(response, list, "用户仪器绑定日志数据");
}
/**
*
*/
@RequiresPermissions("system:log:query")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(wxUserInstrumentLogService.selectWxUserInstrumentLogById(id));
}
/**
*
*/
@RequiresPermissions("system:log:add")
@Log(title = "用户仪器绑定日志", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody WxUserInstrumentLog wxUserInstrumentLog)
{
return toAjax(wxUserInstrumentLogService.insertWxUserInstrumentLog(wxUserInstrumentLog));
}
/**
*
*/
@RequiresPermissions("system:log:edit")
@Log(title = "用户仪器绑定日志", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody WxUserInstrumentLog wxUserInstrumentLog)
{
return toAjax(wxUserInstrumentLogService.updateWxUserInstrumentLog(wxUserInstrumentLog));
}
/**
*
*/
@RequiresPermissions("system:log:remove")
@Log(title = "用户仪器绑定日志", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(wxUserInstrumentLogService.deleteWxUserInstrumentLogByIds(ids));
}
}

@ -0,0 +1,62 @@
package com.flossom.system.service;
import com.flossom.common.core.domain.entity.WxInstrumentSerial;
import java.util.List;
/**
* Service
*
* @author flossom
* @date 2024-01-10
*/
public interface IWxInstrumentSerialService
{
/**
*
*
* @param id
* @return
*/
public WxInstrumentSerial selectWxInstrumentSerialById(Long id);
/**
*
*
* @param wxInstrumentSerial
* @return
*/
public List<WxInstrumentSerial> selectWxInstrumentSerialList(WxInstrumentSerial wxInstrumentSerial);
/**
*
*
* @param wxInstrumentSerial
* @return
*/
public int insertWxInstrumentSerial(WxInstrumentSerial wxInstrumentSerial);
/**
*
*
* @param wxInstrumentSerial
* @return
*/
public int updateWxInstrumentSerial(WxInstrumentSerial wxInstrumentSerial);
/**
*
*
* @param ids
* @return
*/
public int deleteWxInstrumentSerialByIds(Long[] ids);
/**
*
*
* @param id
* @return
*/
public int deleteWxInstrumentSerialById(Long id);
}

@ -0,0 +1,62 @@
package com.flossom.system.service;
import com.flossom.common.core.domain.entity.WxUserInstrumentLog;
import java.util.List;
/**
* Service
*
* @author flossom
* @date 2024-01-10
*/
public interface IWxUserInstrumentLogService
{
/**
*
*
* @param id
* @return
*/
public WxUserInstrumentLog selectWxUserInstrumentLogById(Long id);
/**
*
*
* @param wxUserInstrumentLog
* @return
*/
public List<WxUserInstrumentLog> selectWxUserInstrumentLogList(WxUserInstrumentLog wxUserInstrumentLog);
/**
*
*
* @param wxUserInstrumentLog
* @return
*/
public int insertWxUserInstrumentLog(WxUserInstrumentLog wxUserInstrumentLog);
/**
*
*
* @param wxUserInstrumentLog
* @return
*/
public int updateWxUserInstrumentLog(WxUserInstrumentLog wxUserInstrumentLog);
/**
*
*
* @param ids
* @return
*/
public int deleteWxUserInstrumentLogByIds(Long[] ids);
/**
*
*
* @param id
* @return
*/
public int deleteWxUserInstrumentLogById(Long id);
}

@ -0,0 +1,79 @@
package com.flossom.system.service;
import com.flossom.common.core.domain.entity.WxUserInstrument;
import java.util.List;
import java.util.Map;
/**
* Service
*
* @author flossom
* @date 2024-01-10
*/
public interface IWxUserInstrumentService
{
/**
*
*
* @param id
* @return
*/
public WxUserInstrument selectWxUserInstrumentById(Long id);
/**
*
*
* @param wxUserInstrument
* @return
*/
public List<WxUserInstrument> selectWxUserInstrumentList(WxUserInstrument wxUserInstrument);
/**
*
*
* @param wxUserInstrument
* @return
*/
public int insertWxUserInstrument(WxUserInstrument wxUserInstrument);
/**
*
*
* @param wxUserInstrument
* @return
*/
public int updateWxUserInstrument(WxUserInstrument wxUserInstrument);
/**
*
*
* @param ids
* @return
*/
public int deleteWxUserInstrumentByIds(Long[] ids);
/**
*
*
* @param id
* @return
*/
public int deleteWxUserInstrumentById(Long id);
/**
*
*
* @param wxUserInstrument
* @return
*/
public Map<String,String> changeSerial(WxUserInstrument wxUserInstrument);
/**
*
*
* @param wxUserInstrument
* @return
*/
public int changeGuarantee(WxUserInstrument wxUserInstrument);
}

@ -12,23 +12,36 @@ import java.util.List;
/**
* Service
*
*
* @author flossom
* @date 2023-12-08
*/
public interface IWxUserMemberService
public interface
IWxUserMemberService
{
/**
*
*
*
* @param id
* @return
*/
public WxUserMemberVo selectWxUserMemberById(Long id);
/**
*
*
* @param id
* @return
*/
public WxUserMember selectWxUserMemberByIdInit(Long id);
/**
*
*
*
* @param wxUserMember
* @return
*/
@ -44,7 +57,7 @@ public interface IWxUserMemberService
/**
*
*
*
* @param wxUserMember
* @return
*/
@ -52,7 +65,7 @@ public interface IWxUserMemberService
/**
*
*
*
* @param wxUserMember
* @return
*/
@ -60,7 +73,7 @@ public interface IWxUserMemberService
/**
*
*
*
* @param ids
* @return
*/
@ -68,7 +81,7 @@ public interface IWxUserMemberService
/**
*
*
*
* @param id
* @return
*/

@ -0,0 +1,96 @@
package com.flossom.system.service.impl;
import java.util.List;
import com.flossom.common.core.domain.entity.WxInstrumentSerial;
import com.flossom.common.core.mapper.WxInstrumentSerialMapper;
import com.flossom.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.flossom.system.service.IWxInstrumentSerialService;
/**
* Service
*
* @author flossom
* @date 2024-01-10
*/
@Service
public class WxInstrumentSerialServiceImpl implements IWxInstrumentSerialService
{
@Autowired
private WxInstrumentSerialMapper wxInstrumentSerialMapper;
/**
*
*
* @param id
* @return
*/
@Override
public WxInstrumentSerial selectWxInstrumentSerialById(Long id)
{
return wxInstrumentSerialMapper.selectWxInstrumentSerialById(id);
}
/**
*
*
* @param wxInstrumentSerial
* @return
*/
@Override
public List<WxInstrumentSerial> selectWxInstrumentSerialList(WxInstrumentSerial wxInstrumentSerial)
{
return wxInstrumentSerialMapper.selectWxInstrumentSerialList(wxInstrumentSerial);
}
/**
*
*
* @param wxInstrumentSerial
* @return
*/
@Override
public int insertWxInstrumentSerial(WxInstrumentSerial wxInstrumentSerial)
{
wxInstrumentSerial.setCreateTime(DateUtils.getNowDate());
return wxInstrumentSerialMapper.insertWxInstrumentSerial(wxInstrumentSerial);
}
/**
*
*
* @param wxInstrumentSerial
* @return
*/
@Override
public int updateWxInstrumentSerial(WxInstrumentSerial wxInstrumentSerial)
{
return wxInstrumentSerialMapper.updateWxInstrumentSerial(wxInstrumentSerial);
}
/**
*
*
* @param ids
* @return
*/
@Override
public int deleteWxInstrumentSerialByIds(Long[] ids)
{
return wxInstrumentSerialMapper.deleteWxInstrumentSerialByIds(ids);
}
/**
*
*
* @param id
* @return
*/
@Override
public int deleteWxInstrumentSerialById(Long id)
{
return wxInstrumentSerialMapper.deleteWxInstrumentSerialById(id);
}
}

@ -114,21 +114,27 @@ public class WxScriptTagServiceImpl implements IWxScriptTagService
WxScriptTag tag = new WxScriptTag();
tag.setTagId(tagId);
List<WxScriptTag> wxScriptTags = wxScriptTagMapper.selectWxScriptTagList(tag);
System.out.println("根据删除的标签ID"+tag+",获取到话术标签列表信息:"+wxScriptTags.size());
// 开始组装新的数据以及更新源数据
if (!CollectionUtils.isEmpty(wxScriptTags)) {
for (WxScriptTag wxScriptTag: wxScriptTags) {
Long scriptId = wxScriptTag.getScriptId();
// 话术模板
WxScriptTemplate wxScriptTemplate = wxScriptTemplateMapper.selectWxScriptTemplateById(scriptId);
System.out.println("根据删除的标签ID"+tag+",话术模板:"+wxScriptTemplate.getScriptName());
if (Objects.nonNull(wxScriptTemplate)) {
WxScriptTag tagsVO = new WxScriptTag();
tagsVO.setScriptId(scriptId);
// 反查得到所有的标签
List<WxScriptTag> wxScriptTotalTags = wxScriptTagMapper.selectWxScriptTagList(tagsVO);
System.out.println("根据删除的标签ID"+tag+",获取到所有的标签信息:"+wxScriptTotalTags.size());
// 过滤删除的标签
if (!CollectionUtils.isEmpty(wxScriptTotalTags)) {
wxScriptTemplate.setTagNames("");
wxScriptTemplate.setTagIds("");
// 获取过滤后的标签的信息
List<WxScriptTag> collectList = wxScriptTotalTags.stream().filter(x -> !String.valueOf(x.getTagId()).equals(String.valueOf(tagId))).collect(Collectors.toList());
System.out.println("根据删除的标签ID"+tag+",过滤后:"+collectList.size());
List<SysTag> createSysTagList = Lists.newArrayList();
if (!CollectionUtils.isEmpty(collectList)) {
for (WxScriptTag scriptTag : collectList) {
@ -144,8 +150,8 @@ public class WxScriptTagServiceImpl implements IWxScriptTagService
List<Long> resultList = createSysTagList.stream().map(SysTag::getId).collect(Collectors.toList());
String ids = StringUtils.join(resultList, ",");
wxScriptTemplate.setTagIds(ids);
wxScriptTemplateMapper.updateWxScriptTemplate(wxScriptTemplate);
}
wxScriptTemplateMapper.updateWxScriptTemplate(wxScriptTemplate);
}
}
}

@ -0,0 +1,97 @@
package com.flossom.system.service.impl;
import java.util.List;
import com.flossom.common.core.domain.entity.WxUserInstrumentLog;
import com.flossom.common.core.mapper.WxUserInstrumentLogMapper;
import com.flossom.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.flossom.system.service.IWxUserInstrumentLogService;
/**
* Service
*
* @author flossom
* @date 2024-01-10
*/
@Service
public class WxUserInstrumentLogServiceImpl implements IWxUserInstrumentLogService
{
@Autowired
private WxUserInstrumentLogMapper wxUserInstrumentLogMapper;
/**
*
*
* @param id
* @return
*/
@Override
public WxUserInstrumentLog selectWxUserInstrumentLogById(Long id)
{
return wxUserInstrumentLogMapper.selectWxUserInstrumentLogById(id);
}
/**
*
*
* @param wxUserInstrumentLog
* @return
*/
@Override
public List<WxUserInstrumentLog> selectWxUserInstrumentLogList(WxUserInstrumentLog wxUserInstrumentLog)
{
return wxUserInstrumentLogMapper.selectWxUserInstrumentLogList(wxUserInstrumentLog);
}
/**
*
*
* @param wxUserInstrumentLog
* @return
*/
@Override
public int insertWxUserInstrumentLog(WxUserInstrumentLog wxUserInstrumentLog)
{
wxUserInstrumentLog.setCreateTime(DateUtils.getNowDate());
// 设置系列号图片
return wxUserInstrumentLogMapper.insertWxUserInstrumentLog(wxUserInstrumentLog);
}
/**
*
*
* @param wxUserInstrumentLog
* @return
*/
@Override
public int updateWxUserInstrumentLog(WxUserInstrumentLog wxUserInstrumentLog)
{
return wxUserInstrumentLogMapper.updateWxUserInstrumentLog(wxUserInstrumentLog);
}
/**
*
*
* @param ids
* @return
*/
@Override
public int deleteWxUserInstrumentLogByIds(Long[] ids)
{
return wxUserInstrumentLogMapper.deleteWxUserInstrumentLogByIds(ids);
}
/**
*
*
* @param id
* @return
*/
@Override
public int deleteWxUserInstrumentLogById(Long id)
{
return wxUserInstrumentLogMapper.deleteWxUserInstrumentLogById(id);
}
}

@ -0,0 +1,247 @@
package com.flossom.system.service.impl;
import java.time.LocalDateTime;
import java.time.temporal.ChronoUnit;
import java.util.*;
import java.util.stream.Collectors;
import com.alibaba.nacos.shaded.com.google.common.collect.Maps;
import com.flossom.common.core.domain.entity.WxInstrumentSerial;
import com.flossom.common.core.domain.entity.WxUserInstrument;
import com.flossom.common.core.domain.entity.WxUserInstrumentLog;
import com.flossom.common.core.domain.entity.WxUserMember;
import com.flossom.common.core.mapper.*;
import com.flossom.common.core.utils.DateUtils;
import com.flossom.common.core.utils.StringUtils;
import org.apache.commons.compress.utils.Lists;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.flossom.system.service.IWxUserInstrumentService;
import org.springframework.util.CollectionUtils;
import org.springframework.util.unit.DataUnit;
/**
* Service
*
* @author flossom
* @date 2024-01-10
*/
@Service
public class WxUserInstrumentServiceImpl implements IWxUserInstrumentService
{
@Autowired
private WxUserInstrumentMapper wxUserInstrumentMapper;
@Autowired
private WxUserMemberMapper wxUserMemberMapper;
@Autowired
private WxInstrumentMapper wxInstrumentMapper;
@Autowired
private WxInstrumentSerialMapper instrumentSerialMapper;
@Autowired
private WxUserInstrumentLogMapper wxUserInstrumentLogMapper;
/**
*
*
* @param id
* @return
*/
@Override
public WxUserInstrument selectWxUserInstrumentById(Long id)
{
return wxUserInstrumentMapper.selectWxUserInstrumentById(id);
}
/**
*
*
* @param wxUserInstrument
* @return
*/
@Override
public List<WxUserInstrument> selectWxUserInstrumentList(WxUserInstrument wxUserInstrument)
{
// 处理用户昵称
if (StringUtils.isNotEmpty(wxUserInstrument.getNickName())){
WxUserMember userMember = new WxUserMember();
userMember.setNickname(wxUserInstrument.getNickName());
List<WxUserMember> wxUserMembersList = wxUserMemberMapper.selectWxUserMemberList(userMember);
if (!CollectionUtils.isEmpty(wxUserMembersList)) {
String userIds = (wxUserMembersList.stream().map(WxUserMember::getId).collect(Collectors.toList())).stream().map(String::valueOf).collect(Collectors.joining(","));
wxUserInstrument.setUserIds(userIds);
}
}
// 处理用户ID
if (!CollectionUtils.isEmpty(wxUserInstrument.getUserIdArray())){
String userIds =wxUserInstrument.getUserIdArray().stream().map(String::valueOf).collect(Collectors.joining(","));
if (StringUtils.isNotEmpty(wxUserInstrument.getUserIds())) {
wxUserInstrument.setUserIds(wxUserInstrument.getUserIds()+","+userIds);
} else {
wxUserInstrument.setUserIds(userIds);
}
}
// 处理手机号码
if (StringUtils.isNotEmpty(wxUserInstrument.getUserPhone())){
List<Long> userIdList = Lists.newArrayList();
// 获取手机集合
List<String> mobileList = Arrays.asList(wxUserInstrument.getUserPhone().split(",")).stream().map(String::valueOf).collect(Collectors.toList());
if (!CollectionUtils.isEmpty(mobileList)) {
for (String mobile: mobileList) {
List<WxUserMember> wxUserMembers = wxUserMemberMapper.selectWxUserMemberByMobile(mobile);
if (!CollectionUtils.isEmpty(wxUserMembers)) {
userIdList.add(wxUserMembers.get(0).getId());
}
}
}
if(!CollectionUtils.isEmpty(userIdList)) {
String userIds = userIdList.stream().map(String::valueOf).collect(Collectors.joining(","));
if (StringUtils.isNotEmpty(wxUserInstrument.getUserIds())) {
wxUserInstrument.setUserIds(wxUserInstrument.getUserIds()+","+userIds);
} else {
wxUserInstrument.setUserIds(userIds);
}
}
}
// 处理仪器字段
if (!CollectionUtils.isEmpty(wxUserInstrument.getInstrumentIdArray())) {
String instrumentIds = wxUserInstrument.getInstrumentIdArray().stream().map(String::valueOf).collect(Collectors.joining(","));
wxUserInstrument.setInstrumentIds(instrumentIds);
}
// 查询绑定的状态
if (!CollectionUtils.isEmpty(wxUserInstrument.getBindingStatusArray())) {
String bindStatus = wxUserInstrument.getBindingStatusArray().stream().map(String::valueOf).collect(Collectors.joining(","));
wxUserInstrument.setMapperBindStatus(bindStatus);
}
return wxUserInstrumentMapper.selectWxUserInstrumentList(wxUserInstrument);
}
/**
*
*
* @param wxUserInstrument
* @return
*/
@Override
public int insertWxUserInstrument(WxUserInstrument wxUserInstrument)
{
wxUserInstrument.setCreateTime(DateUtils.getNowDate());
return wxUserInstrumentMapper.insertWxUserInstrument(wxUserInstrument);
}
/**
*
*
* @param wxUserInstrument
* @return
*/
@Override
public int updateWxUserInstrument(WxUserInstrument wxUserInstrument)
{
wxUserInstrument.setUpdateTime(DateUtils.getNowDate());
return wxUserInstrumentMapper.updateWxUserInstrument(wxUserInstrument);
}
/**
*
*
* @param ids
* @return
*/
@Override
public int deleteWxUserInstrumentByIds(Long[] ids)
{
return wxUserInstrumentMapper.deleteWxUserInstrumentByIds(ids);
}
/**
*
*
* @param id
* @return
*/
@Override
public int deleteWxUserInstrumentById(Long id)
{
return wxUserInstrumentMapper.deleteWxUserInstrumentById(id);
}
@Override
public Map<String,String> changeSerial(WxUserInstrument wxUserInstrument) {
Map<String,String> resultMap = Maps.newHashMap();
// 查询序列号是否有效存在
WxInstrumentSerial serial = new WxInstrumentSerial();
serial.setSerial(wxUserInstrument.getSerial());
List<WxInstrumentSerial> serialList = instrumentSerialMapper.selectWxInstrumentSerialList(serial);
if (CollectionUtils.isEmpty(serialList)) {
resultMap.put("message","序列号无效,请确定后再绑定");
resultMap.put("code", "500");
return resultMap;
}
// 查看是否已经被绑定
WxUserInstrument userInstrument = new WxUserInstrument();
userInstrument.setSerial(wxUserInstrument.getSerial());
List<WxUserInstrument> wxUserInstrumentsList = wxUserInstrumentMapper.selectWxUserInstrumentList(userInstrument);
if (!CollectionUtils.isEmpty(wxUserInstrumentsList)) {
resultMap.put("message","该序列号已经被绑定");
resultMap.put("code", "500");
return resultMap;
}
// 开始绑定
WxUserInstrument userInstrumentRecord = wxUserInstrumentMapper.selectWxUserInstrumentById(wxUserInstrument.getId());
// 操作变更日记
// 是否已经绑定
if (0 == userInstrumentRecord.getBindingStatus()) {
// 已经绑定的情况下,先解绑,再绑定 0-已绑 2-解绑
this.saveLog(userInstrumentRecord,2);
}
// 更新信息
WxInstrumentSerial instrumentSerialVo = serialList.get(0);
userInstrumentRecord.setInstrumentId(instrumentSerialVo.getInstrumentId());
userInstrumentRecord.setSerial(instrumentSerialVo.getSerial());
userInstrumentRecord.setInstrumentName(instrumentSerialVo.getInstrumentName());
// userInstrumentRecord.setSerialImage(userInstrument.getSerialImage());
// 从新绑定
this.saveLog(userInstrumentRecord,0);
// 更新绑定数据
wxUserInstrumentMapper.updateWxUserInstrument(userInstrumentRecord);
resultMap.put("message","换绑序列号成功");
resultMap.put("code", "200");
return resultMap ;
}
@Override
public int changeGuarantee(WxUserInstrument wxUserInstrument) {
WxUserInstrument userInstrumentRecord = wxUserInstrumentMapper.selectWxUserInstrumentById(wxUserInstrument.getId());
if (Objects.nonNull(wxUserInstrument.getGuarantee())) {
// 开始处理时间 需要变更的时间
Long guarantee = wxUserInstrument.getGuarantee();
userInstrumentRecord.setGuarantee(guarantee);
// 设置到期时间
Calendar calendar = Calendar.getInstance();
// 将当前时间加多少年
calendar.add(Calendar.YEAR, wxUserInstrument.getGuarantee().intValue());
Date lastYear = calendar.getTime();
userInstrumentRecord.setGuaranteeEndtime(lastYear);
wxUserInstrumentMapper.updateWxUserInstrument(userInstrumentRecord);
}
return 1;
}
public int saveLog(WxUserInstrument userInstrumentRecord, int status){
WxUserInstrumentLog log = new WxUserInstrumentLog();
log.setUserInstrumentId(userInstrumentRecord.getId());
log.setBindingStatus(status);
log.setGuarantee(userInstrumentRecord.getGuarantee());
log.setInstrumentId(userInstrumentRecord.getInstrumentId());
log.setUserId(userInstrumentRecord.getUserId());
log.setInstrumentName(userInstrumentRecord.getInstrumentName());
log.setSerialImage(userInstrumentRecord.getSerialImage());
log.setSerial(userInstrumentRecord.getSerial());
log.setGuaranteeEndtime(userInstrumentRecord.getGuaranteeEndtime());
log.setCreateTime((DateUtils.getNowDate()));
return wxUserInstrumentLogMapper.insertWxUserInstrumentLog(log);
}
}

@ -97,6 +97,11 @@ public class WxUserMemberServiceImpl implements IWxUserMemberService {
return wxUserMemberVo;
}
@Override
public WxUserMember selectWxUserMemberByIdInit(Long id) {
return wxUserMemberMapper.selectWxUserMemberById(id);
}
/**
*
*

@ -0,0 +1,63 @@
import request from '@/utils/request'
// 查询用户仪器绑定列表
export function listUserInstrument(query) {
return request({
url: '/system/userInstrument/list',
method: 'get',
params: query
})
}
// 查询用户仪器绑定详细
export function getInstrument(id) {
return request({
url: '/system/userInstrument/' + id,
method: 'get'
})
}
// 新增用户仪器绑定
export function addInstrument(data) {
return request({
url: '/system/userInstrument',
method: 'post',
data: data
})
}
// 修改用户仪器绑定
export function updateInstrument(data) {
return request({
url: '/system/userInstrument',
method: 'put',
data: data
})
}
// 删除用户仪器绑定
export function delInstrument(id) {
return request({
url: '/system/userInstrument/' + id,
method: 'delete'
})
}
// 换绑序列号
export function changeSerial(data) {
return request({
url: '/system/userInstrument/changeSerial',
method: 'put',
data: data
})
}
// 变更保修日期
export function changeGuarantee(data) {
return request({
url: '/system/userInstrument/changeGuarantee',
method: 'put',
data: data
})
}

@ -0,0 +1,44 @@
import request from '@/utils/request'
// 查询用户仪器绑定日志列表
export function listLog(query) {
return request({
url: '/system/log/list',
method: 'get',
params: query
})
}
// 查询用户仪器绑定日志详细
export function getLog(id) {
return request({
url: '/system/log/' + id,
method: 'get'
})
}
// 新增用户仪器绑定日志
export function addLog(data) {
return request({
url: '/system/log',
method: 'post',
data: data
})
}
// 修改用户仪器绑定日志
export function updateLog(data) {
return request({
url: '/system/log',
method: 'put',
data: data
})
}
// 删除用户仪器绑定日志
export function delLog(id) {
return request({
url: '/system/log/' + id,
method: 'delete'
})
}

@ -154,37 +154,37 @@
</el-select>
</el-form-item>
</el-col>
<el-col :span="24" v-if="form.parentId != 0 && form.type == 1">
<el-col :span="24" v-if=" form.type == 1">
<el-form-item label="内部链接" prop="link">
<el-input v-model="form.link" placeholder="请输入内部链接" />
</el-form-item>
</el-col>
<el-col :span="24" v-if="form.parentId != 0 && form.type == 1">
<el-col :span="24" v-if=" form.type == 1">
<el-form-item label="跳转参数" prop="linkParams">
<el-input v-model="form.linkParams" placeholder="请输入跳转参数" />
</el-form-item>
</el-col>
<el-col :span="24" v-if="form.parentId != 0 && form.type == 3">
<el-col :span="24" v-if=" form.type == 3">
<el-form-item label="外部链接" prop="link">
<el-input v-model="form.link" placeholder="请输入外部链接" />
</el-form-item>
</el-col>
<el-col :span="24" v-if="form.parentId != 0 && form.type == 4">
<el-col :span="24" v-if=" form.type == 4">
<el-form-item label="APPID" prop="redirectAppid">
<el-input v-model="form.redirectAppid" placeholder="请输入小程序APPID" />
</el-form-item>
</el-col>
<el-col :span="24" v-if="form.parentId != 0 && form.type == 4" label-width="90px">
<el-col :span="24" v-if=" form.type == 4" label-width="90px">
<el-form-item label="小程序页面" prop="redirectUrl">
<el-input v-model="form.redirectUrl" placeholder="请输入小程序页面" />
</el-form-item>
</el-col>
<el-col :span="24" v-if="form.parentId != 0 && form.type == 5 || form.type == 6">
<el-col :span="24" v-if=" form.type == 5 || form.type == 6">
<el-form-item label="视频号ID" prop="videoNo">
<el-input v-model="form.videoNo" placeholder="请输入视频号ID" />
</el-form-item>
</el-col>
<el-col :span="24" v-if="form.parentId != 0 && form.type == 5" label-width="90px">
<el-col :span="24" v-if=" form.type == 5" label-width="90px">
<el-form-item label="feedId" prop="feedId">
<el-input v-model="form.feedId" placeholder="请输入视频号feedId" />
</el-form-item>
@ -354,15 +354,13 @@ export default {
if (row.id) {
this.topAdd = false;
this.title = "添加二级话术";
this.form.type = 0;
// this.form.type = 0;
} else {
this.topAdd = true;
this.title = "添加一级话术";
}
}
this.open = true;
listTemplate().then(response => {
this.deptOptions = this.handleTree(response.data, "id");
});

@ -0,0 +1,651 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="会员昵称" prop="nickName">
<el-input
v-model="queryParams.nickName"
placeholder="请输入单个会员昵称搜索"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-popover placement="top-start" width="200" trigger="click"
content="手机号码和用户编号,满足其中之一内容即可">
<el-form-item label="用户编号" prop="userIdArray" slot="reference">
<el-input
v-model="queryParams.userIdArray"
placeholder="搜索多个请用英文逗号隔开"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
</el-popover>
<el-popover placement="top-start" width="200" trigger="click"
content="手机号码和用户编号,满足其中之一内容即可">
<el-form-item label="手机号码" prop="userPhone" slot="reference">
<el-input
v-model="queryParams.userPhone"
placeholder="搜索多个请用英文逗号隔开"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
</el-popover>
<el-form-item label="仪器名称" prop="source">
<el-select
v-model="queryParams.instrumentIdArray"
placeholder="请选择类型"
multiple
:style="{ width: '100%' }"
clearable
>
<el-option
v-for="item in instrumentList"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="绑定状态" prop="source">
<el-select
v-model="queryParams.bindingStatus"
placeholder="请选择类型"
:style="{ width: '100%' }"
clearable
>
<el-option label="全部" value="" />
<el-option label="未绑定" value="1" />
<el-option label="已绑定" value="0" />
</el-select>
</el-form-item>
<el-form-item label="仪器ID" prop="instrumentId">
<el-input
v-model="queryParams.instrumentId"
placeholder="请输入仪器ID进行搜索"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="序列号" prop="serial">
<el-input
v-model="queryParams.serial"
placeholder="请输入序列号进行搜索"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="操作开始" prop="startTime">
<el-date-picker clearable
v-model="queryParams.startTime"
type="datetime"
value-format="yyyy-MM-dd HH:mm"
placeholder="请选择操作开始时间">
</el-date-picker>
</el-form-item>
<el-form-item prop="endTime">
<el-date-picker clearable
v-model="queryParams.endTime"
type="datetime"
value-format="yyyy-MM-dd HH:mm"
placeholder="请选择操作结束时间">
</el-date-picker>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button>
</el-form-item>
</el-form>
<!-- <el-row :gutter="10" class="mb8">-->
<!-- <el-col :span="1.5">-->
<!-- <el-button-->
<!-- type="primary"-->
<!-- plain-->
<!-- icon="el-icon-plus"-->
<!-- size="mini"-->
<!-- @click="handleAdd"-->
<!-- v-hasPermi="['system:instrument:add']"-->
<!-- >新增</el-button>-->
<!-- </el-col>-->
<!-- <el-col :span="1.5">-->
<!-- <el-button-->
<!-- type="success"-->
<!-- plain-->
<!-- icon="el-icon-edit"-->
<!-- size="mini"-->
<!-- :disabled="single"-->
<!-- @click="handleUpdate"-->
<!-- v-hasPermi="['system:instrument:edit']"-->
<!-- >修改</el-button>-->
<!-- </el-col>-->
<!-- <el-col :span="1.5">-->
<!-- <el-button-->
<!-- type="danger"-->
<!-- plain-->
<!-- icon="el-icon-delete"-->
<!-- size="mini"-->
<!-- :disabled="multiple"-->
<!-- @click="handleDelete"-->
<!-- v-hasPermi="['system:instrument:remove']"-->
<!-- >删除</el-button>-->
<!-- </el-col>-->
<!-- <el-col :span="1.5">-->
<!-- <el-button-->
<!-- type="warning"-->
<!-- plain-->
<!-- icon="el-icon-download"-->
<!-- size="mini"-->
<!-- @click="handleExport"-->
<!-- v-hasPermi="['system:instrument:export']"-->
<!-- >导出</el-button>-->
<!-- </el-col>-->
<!-- <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>-->
<!-- </el-row>-->
<el-table v-loading="loading" :data="userInstrumentList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="序号" align="center" prop="id" />
<el-table-column label="头像" align="center" prop="wxUserMember.headimg" >
<template slot-scope="scope">
<el-image :src="scope.row.wxUserMember.headimg" style="width: 60px;height: 80px" :preview-src-list="[scope.row.wxUserMember.headimg]">
<div slot="placeholder" class="image-slot"><span class="dot"></span>
</div>
</el-image>
</template>
</el-table-column>
<el-table-column label="会员昵称" align="center" prop="wxUserMember.nickname" />
<el-table-column label="用户编号" align="center" prop="wxUserMember.id" />
<el-table-column label="手机号码" align="center" prop="wxUserMember.mobile" />
<el-table-column label="仪器名称" align="center" prop="wxInstrument.name" />
<el-table-column label="保修年限" align="center" prop="guarantee" />
<el-table-column label="保修到期时间" align="center" prop="guaranteeEndtime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.guaranteeEndtime, '{y}-{m}-{d} {h}:{m}') }}</span>
</template>
</el-table-column>
<el-table-column label="绑定状态" align="center" prop="bindingStatus" >
<template slot-scope="scope">
<span v-show="scope.row.bindingStatus == 0"></span>
<span v-show="scope.row.bindingStatus == 1"></span>
<span v-show="scope.row.bindingStatus == 2"></span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-view"
@click="detailShow(scope.row)"
v-hasPermi="['system:instrument:edit']"
>记录详情</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="bingCancel(scope.row)"
v-hasPermi="['system:instrument:edit']"
>解绑</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-bell"
@click="changeSerialHandler(scope.row)"
v-hasPermi="['system:instrument:edit']"
>换绑序列号</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="changeGuaranteeHandler(scope.row)"
v-hasPermi="['system:instrument:edit']"
>编辑保修年限</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改用户仪器绑定对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="用户id" prop="userId">
<el-input v-model="form.userId" placeholder="请输入用户id" />
</el-form-item>
<el-form-item label="序列号" prop="serial">
<el-input v-model="form.serial" placeholder="请输入序列号" />
</el-form-item>
<el-form-item label="仪器id" prop="instrumentId">
<el-input v-model="form.instrumentId" placeholder="请输入仪器id" />
</el-form-item>
<el-form-item label="仪器名称" prop="instrumentName">
<el-input v-model="form.instrumentName" placeholder="请输入仪器名称" />
</el-form-item>
<el-form-item label="序列号图片" prop="serialImage">
<image-upload v-model="form.serialImage"/>
</el-form-item>
<el-form-item label="保修日期" prop="guarantee">
<el-input v-model="form.guarantee" placeholder="请输入保修日期" />
</el-form-item>
<el-form-item label="保修到期时间" prop="guaranteeEndtime">
<el-date-picker clearable
v-model="form.guaranteeEndtime"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择保修到期时间">
</el-date-picker>
</el-form-item>
<el-form-item label="${comment}" prop="remark">
<el-input v-model="form.remark" placeholder="请输入${comment}" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
<!-- 详情记录对话框 -->
<el-dialog :title="detailTitle" :visible.sync="detailOpen" width="880px" append-to-body>
<el-table v-loading="loading" :data="userInstrumentLogList">
<el-table-column label="序号" align="center" prop="id" />
<el-table-column label="仪器序列号" align="center" prop="serial" />
<el-table-column label="仪器号图片" align="center" prop="serialImage" >
<template slot-scope="scope">
<el-image :src="scope.row.serialImage" style="width: 60px;height: 80px" :preview-src-list="[scope.row.serialImage]">
<div slot="placeholder" class="image-slot"><span class="dot"></span>
</div>
</el-image>
</template>
</el-table-column>
<el-table-column label="类型" align="center" prop="bindingStatus" >
<template slot-scope="scope">
<span v-show="scope.row.bindingStatus == 0"></span>
<span v-show="scope.row.bindingStatus == 1"></span>
<span v-show="scope.row.bindingStatus == 2"></span>
</template>
</el-table-column>
<el-table-column label="操作时间" align="center" prop="createTime" >
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
</el-table>
<pagination
v-show="logTotal>0"
:total="logTotal"
:page.sync="queryLogParams.pageNum"
:limit.sync="queryLogParams.pageSize"
@pagination="getList"
/>
</el-dialog>
<el-dialog :title="serialTitle" :visible.sync="serialOpen" width="600px" append-to-body>
<el-form :model="serialForm" ref="serialForm" label-width="100px" class="demo-ruleForm">
<el-form-item
label="序列号"
prop="changeSerial" >
<!-- :rules="[{ required: true, message: '序列号不能为空'}]"-->
<!-- >-->
<el-input v-model="serialForm.serial" autocomplete="off" maxlength="30"></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="submitSerial('serialForm')"></el-button>
<el-button @click="resetSerialForm('serialForm')"></el-button>
</el-form-item>
</el-form>
</el-dialog>
<el-dialog :title="guaranteeTitle" :visible.sync="guaranteeOpen" width="600px" append-to-body>
<el-form :model="guaranteeForm" ref="guaranteeForm" label-width="100px" class="demo-ruleForm">
<el-form-item
label="保修日期"
prop="changeSerial" >
<el-select
v-model="guaranteeForm.guarantee"
placeholder="请选择保修日期"
:style="{ width: '100%' }"
clearable
>
<el-option label="1年" value="1" />
<el-option label="2年" value="2" />
<el-option label="3年" value="3" />
<el-option label="4年" value="4" />
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="submitGuarantee()"></el-button>
<el-button @click="resetSerialForm('guaranteeForm')"></el-button>
</el-form-item>
</el-form>
</el-dialog>
</div>
</template>
<script>
import { listUserInstrument, getInstrument, delInstrument, addInstrument, updateInstrument,changeSerial,changeGuarantee } from "@/api/system/userInstrument";
import {listInstrument} from "@/api/system/instrument";
import {listLog,addLog} from "@/api/system/userInstrumentLog"
export default {
name: "Instrument",
data() {
return {
guaranteeOpen: false,
guaranteeTitle: "编辑保修日期",
guaranteeForm: {
id: "",
guarantee: ""
},
serialForm: {
id: "",
serial: "",
},
//
serialTitle: "换绑序列号",
//
serialOpen: false,
//
detailTitle: "记录详情",
//
detailOpen: false,
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
logTotal: 0,
//
userInstrumentList: [],
//
userInstrumentLogList: [],
//
instrumentList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
nickName:null,
userId: null,
serial: null,
instrumentId: null,
instrumentName: null,
serialImage: null,
guarantee: null,
guaranteeEndtime: null,
bindingStatus: "",
status: null,
startTime:null,
entTime:null,
instrumentIdArray: null,
userIdArray: null
},
queryLogParams: {
pageNum: 1,
pageSize: 10,
userInstrumentId: null,
},
//
form: {},
//
rules: {
userId: [
{ required: true, message: "用户id不能为空", trigger: "blur" }
],
serial: [
{ required: true, message: "序列号不能为空", trigger: "blur" }
],
instrumentId: [
{ required: true, message: "仪器id不能为空", trigger: "blur" }
],
instrumentName: [
{ required: true, message: "仪器名称不能为空", trigger: "blur" }
],
serialImage: [
{ required: true, message: "序列号图片不能为空", trigger: "blur" }
],
guarantee: [
{ required: true, message: "保修日期不能为空", trigger: "blur" }
],
guaranteeEndtime: [
{ required: true, message: "保修到期时间不能为空", trigger: "blur" }
],
bindingStatus: [
{ required: true, message: "绑定状态1未绑定2已解绑不能为空", trigger: "change" }
],
}
};
},
created() {
this.getList();
this.queryInstrument();
},
methods: {
resetSerialForm(formName) {
this.serialForm.serial = ""
this.guaranteeForm.guarantee = "";
},
queryInstrument(){
listInstrument({}).then(response => {
this.instrumentList = response.rows;
});
},
/** 查询用户仪器绑定列表 */
getList() {
this.loading = true;
listUserInstrument(this.queryParams).then(response => {
this.userInstrumentList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
userId: null,
serial: null,
instrumentId: null,
instrumentName: null,
serialImage: null,
guarantee: null,
guaranteeEndtime: null,
bindingStatus: null,
status: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null,
remark: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加用户仪器绑定";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getInstrument(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改用户仪器绑定";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateInstrument(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addInstrument(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除用户仪器绑定编号为"' + ids + '"的数据项?').then(function() {
return delInstrument(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('system/instrument/export', {
...this.queryParams
}, `instrument_${new Date().getTime()}.xlsx`)
},
/** 展示详情 */
detailShow(row){
this.queryLogParams.userInstrumentId = row.id;
listLog(this.queryLogParams).then(response => {
this.detailOpen = true;
this.userInstrumentLogList = response.rows;
this.logTotal = response.total;
});
},
/** 解绑 */
bingCancel(row){
this.$confirm('确定将选择的数据解绑序列号?【请谨慎操作,一旦成功将无法撤销】, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
//
if (row.bindingStatus == 1 || row.bindingStatus == 2) {
this.$message({
type: 'error',
message: '当前状态不支持解绑'
});
return ;
}
const updateForm= {id: row.id,bindingStatus: 2};
updateInstrument(updateForm).then(response => {
this.$message({
type: 'success',
message: '解绑成功!'
});
});
//
const logForm = {
userInstrumentId: row.id,
userId: row.userId,
serial: row.serial,
instrumentName: row.instrumentName,
guarantee: row.guarantee,
guaranteeEndtime: row.guaranteeEndtime,
bindingStatus: 2,
instrumentId: row.instrumentId,
serialImage: row.serialImage,
status: 0
};
addLog(logForm).then(response => {
this.getList();
});
}).catch(() => {
this.$message({
type: 'info',
message: '已取消解绑'
});
});
},
//
changeSerialHandler(row){
this.serialForm.serial = ""
this.serialOpen = true;
this.serialForm.id = row.id;
},
submitSerial(){
if (!this.serialForm.serial) {
this.$modal.msgError("序列号不能为空");
return;
}
changeSerial(this.serialForm).then(response => {
if (response.data.code != 200) {
this.$modal.msgError(response.data.message);
} else {
this.$modal.msgSuccess("换绑序列号成功");
this.serialOpen = false;
this.getList();
}
});
},
//
changeGuaranteeHandler(row){
this.guaranteeForm.guarantee = "";
this.guaranteeOpen = true;
this.guaranteeForm.id = row.id;
},
submitGuarantee(){
if (!this.guaranteeForm.guarantee) {
this.$modal.msgError("保修日期不能为空");
return;
}
changeGuarantee(this.guaranteeForm).then(response => {
this.$modal.msgSuccess("保修日期更新成功");
this.guaranteeOpen = false;
this.getList();
});
}
}
};
</script>

@ -335,6 +335,7 @@ export default {
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('system/tagInfo/export', {

Loading…
Cancel
Save