Compare commits

...

28 Commits

Author SHA1 Message Date
382696293@qq.com d1f863ec37 后台积分操作同步数云 2 years ago
382696293@qq.com 9b1b06deab 小程序积分操作 2 years ago
382696293@qq.com 7064af0c7c 获取数云用户信息时,只有会员用户才发起请求 2 years ago
382696293@qq.com 1aa9a244a8 接收文件增加参数名 2 years ago
382696293@qq.com a8edc2c4d1 数云会员注册积分操作对接 2 years ago
382696293@qq.com 898dc1600c 数云会员注册积分操作对接 2 years ago
382696293@qq.com c280405432 数云接口调用工具完善 2 years ago
382696293@qq.com 7c8c7936a1 文件上传最大支持修改 2 years ago
qsj 1a960a201a 提交 2 years ago
qsj a3efaa7c97 Merge branch 'feature-20240104' of https://gitee.com/yunqiang_technology/floatomcloud into feature-20240104 2 years ago
qsj f1b893a32e 提交 2 years ago
382696293@qq.com 947566f58d 根据仪器ID查询膜布和根据仪器ID和膜布ID查询模式列表 2 years ago
382696293@qq.com 6e0c8e6592 膜布添加异常处理 2 years ago
382696293@qq.com 3c28595a54 膜布查询异常处理 2 years ago
382696293@qq.com d77e1b0d42 膜布 2 years ago
382696293@qq.com bea41eb564 膜布 2 years ago
qsj d41b7aaf59 Merge branch 'feature-20240104' of https://gitee.com/yunqiang_technology/floatomcloud into feature-20240104 2 years ago
qsj 330cb57e0a 添加膜布 2 years ago
382696293@qq.com 4addf14637 IOT版本升级介绍 bug 修复 2 years ago
382696293@qq.com 427f31a5ae 仪器新增膜布属性 2 years ago
382696293@qq.com b23b037f0e 膜布管理 2 years ago
382696293@qq.com 9d624206db 文件系统上传文件时对文件重命名 2 years ago
382696293@qq.com a96e79bfbc 文件系统上传文件时对文件重命名 2 years ago
382696293@qq.com df116c3c2f 将模式时长换成时间组件下拉 2 years ago
382696293@qq.com d661447d1a 当模式时长为null时,时间组件异常问题 2 years ago
382696293@qq.com 16a2bc3d78 【ID1000619】
护理记录-字段名称档位1、档位2 档位3、档位4,“档”字写错为“挡”
2 years ago
382696293@qq.com b5de83d4b4 【ID1000613】
全量添加小程序标签确认后报错系统异常
2 years ago
382696293@qq.com 97f9992a82 新增护理记录返回记录ID 2 years ago

@ -113,6 +113,11 @@
<artifactId>swagger-annotations</artifactId>
</dependency>
<!-- Hutool -->
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-core</artifactId>
</dependency>
</dependencies>
</project>

@ -0,0 +1,26 @@
package com.flossom.common.core.constant;
public class IntegralChangTextConstants {
// 完善用户信息
public static final String COMPLETE_INFORMATION = "完善信息,获得奖励积分";
// 绑定仪器
public static final String BINDING_INSTRUMENT = "绑定成功,获得奖励积分";
// 日常打卡
public static final String DAILY_CLOCK = "打卡成功,获得奖励积分";
// 打卡活动打卡
public static final String CLOCK_ACTIVITY_CLOCK = "完成,获得奖励积分";
// 问卷活动打卡
public static final String QUESTIONNAIRE_ACTIVITY_CLOCK = "完成,获得奖励积分";
// 共创活动打卡
public static final String TOGETHER_ACTIVITY_CLOCK = "完成,获得奖励积分";
// 护理计划
public static final String NURSING_ACTIVITY_CLOCK = "完成,获得奖励积分";
}

@ -0,0 +1,83 @@
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_lining
*
* @author flossom
* @date 2024-03-27
*/
public class WxInstrumentLining extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* $column.columnComment
*/
private Long id;
/**
* id
*/
@Excel(name = "仪器id")
private Long instrumentId;
/**
* id
*/
@Excel(name = "膜布id")
private Long liningId;
/**
* 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 setLiningId(Long liningId) {
this.liningId = liningId;
}
public Long getLiningId() {
return liningId;
}
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("liningId", getLiningId())
.append("status", getStatus())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.toString();
}
}

@ -48,6 +48,8 @@ public class WxInstrumentMode extends BaseEntity {
@Excel(name = "状态", readConverterExp = "0=正常,1=停用")
private Integer status;
private Long liningId;
public void setId(Long id) {
this.id = id;
}
@ -96,6 +98,14 @@ public class WxInstrumentMode extends BaseEntity {
this.isNew = isNew;
}
public Long getLiningId() {
return liningId;
}
public void setLiningId(Long liningId) {
this.liningId = liningId;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)

@ -0,0 +1,186 @@
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;
import java.util.List;
/**
* wx_lining
*
* @author flossom
* @date 2024-03-26
*/
public class WxLining extends BaseEntity {
private static final long serialVersionUID = 1L;
private Long id;
/**
*
*/
@Excel(name = "膜布编码")
private String code;
/**
*
*/
@Excel(name = "膜布名称")
private String name;
/**
*
*/
@Excel(name = "膜布描述")
private String desc;
/**
* 1/0
*/
@Excel(name = "购买入口是否显示", readConverterExp = "1=是/0否")
private Long isShowBuy;
/**
* appid
*/
@Excel(name = "购买商城appid")
private String skipAppid;
/**
* PATH
*/
@Excel(name = "购买商城PATH")
private String skipPath;
/**
*
*/
@Excel(name = "膜布图标")
private String icon;
/**
* 0 1
*/
@Excel(name = "状态", readConverterExp = "0=正常,1=禁用")
private Long status;
/**
*
*/
private List<Integer> modeList;
/**
* new
*/
private List<Integer> newModeIdList;
public void setId(Long id) {
this.id = id;
}
public Long getId() {
return id;
}
public void setCode(String code) {
this.code = code;
}
public String getCode() {
return code;
}
public void setName(String name) {
this.name = name;
}
public String getName() {
return name;
}
public void setDesc(String desc) {
this.desc = desc;
}
public String getDesc() {
return desc;
}
public void setIsShowBuy(Long isShowBuy) {
this.isShowBuy = isShowBuy;
}
public Long getIsShowBuy() {
return isShowBuy;
}
public void setSkipAppid(String skipAppid) {
this.skipAppid = skipAppid;
}
public String getSkipAppid() {
return skipAppid;
}
public void setSkipPath(String skipPath) {
this.skipPath = skipPath;
}
public String getSkipPath() {
return skipPath;
}
public void setIcon(String icon) {
this.icon = icon;
}
public String getIcon() {
return icon;
}
public void setStatus(Long status) {
this.status = status;
}
public Long getStatus() {
return status;
}
public List<Integer> getModeList() {
return modeList;
}
public void setModeList(List<Integer> modeList) {
this.modeList = modeList;
}
public List<Integer> getNewModeIdList() {
return newModeIdList;
}
public void setNewModeIdList(List<Integer> newModeIdList) {
this.newModeIdList = newModeIdList;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("code", getCode())
.append("name", getName())
.append("desc", getDesc())
.append("isShowBuy", getIsShowBuy())
.append("skipAppid", getSkipAppid())
.append("skipPath", getSkipPath())
.append("icon", getIcon())
.append("status", getStatus())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.toString();
}
}

@ -2,6 +2,7 @@ package com.flossom.common.core.domain.req;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.flossom.common.core.domain.entity.WxInstrumentFileRelate;
import com.flossom.common.core.domain.entity.WxLining;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
@ -260,6 +261,11 @@ public class WxInstrumentSaveReq {
*/
private String we200BluetoothConnectingContent;
/**
*
*/
private List<WxLining> wxLiningList;
public Long getId() {
return id;
}
@ -619,4 +625,12 @@ public class WxInstrumentSaveReq {
public void setWe200BluetoothConnectingContent(String we200BluetoothConnectingContent) {
this.we200BluetoothConnectingContent = we200BluetoothConnectingContent;
}
public List<WxLining> getWxLiningList() {
return wxLiningList;
}
public void setWxLiningList(List<WxLining> wxLiningList) {
this.wxLiningList = wxLiningList;
}
}

@ -89,12 +89,13 @@ public class ShuYunMember {
* @param name
* @param mobile
*/
public ShuYunMember(String id, String platCode, String shopId, String name, String mobile) {
public ShuYunMember(String id, String platCode, String shopId, String name, String mobile, String created) {
this.id = id;
this.platCode = platCode;
this.shopId = shopId;
this.name = name;
this.mobile = mobile;
this.created = created;
}
/**

@ -0,0 +1,63 @@
package com.flossom.common.core.mapper;
import com.flossom.common.core.domain.entity.WxInstrumentLining;
import java.util.List;
/**
* Mapper
*
* @author flossom
* @date 2024-03-27
*/
public interface WxInstrumentLiningMapper {
/**
*
*
* @param id
* @return
*/
public WxInstrumentLining selectWxInstrumentLiningById(Long id);
/**
*
*
* @param wxInstrumentLining
* @return
*/
public List<WxInstrumentLining> selectWxInstrumentLiningList(WxInstrumentLining wxInstrumentLining);
/**
*
*
* @param wxInstrumentLining
* @return
*/
public int insertWxInstrumentLining(WxInstrumentLining wxInstrumentLining);
/**
*
*
* @param wxInstrumentLining
* @return
*/
public int updateWxInstrumentLining(WxInstrumentLining wxInstrumentLining);
/**
*
*
* @param id
* @return
*/
public int deleteWxInstrumentLiningById(Long id);
/**
*
*
* @param ids
* @return
*/
public int deleteWxInstrumentLiningByIds(Long[] ids);
public int deleteByInstrumentId(Long instrumentId);
}

@ -0,0 +1,61 @@
package com.flossom.common.core.mapper;
import com.flossom.common.core.domain.entity.WxLining;
import java.util.List;
/**
* Mapper
*
* @author flossom
* @date 2024-03-26
*/
public interface WxLiningMapper {
/**
*
*
* @param id
* @return
*/
public WxLining selectWxLiningById(Long id);
/**
*
*
* @param wxLining
* @return
*/
public List<WxLining> selectWxLiningList(WxLining wxLining);
/**
*
*
* @param wxLining
* @return
*/
public int insertWxLining(WxLining wxLining);
/**
*
*
* @param wxLining
* @return
*/
public int updateWxLining(WxLining wxLining);
/**
*
*
* @param id
* @return
*/
public int deleteWxLiningById(Long id);
/**
*
*
* @param ids
* @return
*/
public int deleteWxLiningByIds(Long[] ids);
}

@ -1,6 +1,7 @@
package com.flossom.common.core.mapper;
import com.flossom.common.core.domain.entity.WxMode;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -60,5 +61,5 @@ public interface WxModeMapper
*/
public int deleteWxModeByIds(Long[] ids);
List<WxMode> selectListByInstrumentId(Long instrumentId);
List<WxMode> selectListByInstrumentId(@Param("instrumentId") Long instrumentId, @Param("liningId") Long liningId);
}

@ -26,6 +26,8 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
public static String YYYYMMDDHHMMSS = "yyyyMMddHHmmss";
public static String YYYYMMDDHHMMSSS = "yyyyMMddHHmmssSSS";
public static String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss";
private static String[] parsePatterns = {

@ -1,19 +1,23 @@
package com.flossom.common.core.utils.uuid;
import cn.hutool.core.util.RandomUtil;
import com.flossom.common.core.utils.DateUtils;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
/**
* ID
*
* @author flossom
*/
public class IdUtils
{
public class IdUtils {
/**
* UUID
*
* @return UUID
*/
public static String randomUUID()
{
public static String randomUUID() {
return UUID.randomUUID().toString();
}
@ -22,8 +26,7 @@ public class IdUtils
*
* @return UUID线
*/
public static String simpleUUID()
{
public static String simpleUUID() {
return UUID.randomUUID().toString(true);
}
@ -32,8 +35,7 @@ public class IdUtils
*
* @return UUID
*/
public static String fastUUID()
{
public static String fastUUID() {
return UUID.fastUUID().toString();
}
@ -42,8 +44,16 @@ public class IdUtils
*
* @return UUID线
*/
public static String fastSimpleUUID()
{
public static String fastSimpleUUID() {
return UUID.fastUUID().toString(true);
}
/**
*
*
* @return
*/
public static String generateSequence() {
return "hz_serial_number-" + LocalDateTime.now().format(DateTimeFormatter.ofPattern(DateUtils.YYYYMMDDHHMMSSS)) + RandomUtil.randomInt(1000, 9999);
}
}

@ -0,0 +1,78 @@
<?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.WxInstrumentLiningMapper">
<resultMap type="WxInstrumentLining" id="WxInstrumentLiningResult">
<result property="id" column="id" />
<result property="instrumentId" column="instrument_id" />
<result property="liningId" column="lining_id" />
<result property="status" column="status" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
</resultMap>
<sql id="selectWxInstrumentLiningVo">
select id, instrument_id, lining_id, status, create_by, create_time from wx_instrument_lining
</sql>
<select id="selectWxInstrumentLiningList" parameterType="WxInstrumentLining" resultMap="WxInstrumentLiningResult">
<include refid="selectWxInstrumentLiningVo"/>
<where>
<if test="instrumentId != null "> and instrument_id = #{instrumentId}</if>
<if test="liningId != null "> and lining_id = #{liningId}</if>
<if test="status != null "> and status = #{status}</if>
</where>
</select>
<select id="selectWxInstrumentLiningById" parameterType="Long" resultMap="WxInstrumentLiningResult">
<include refid="selectWxInstrumentLiningVo"/>
where id = #{id}
</select>
<insert id="insertWxInstrumentLining" parameterType="WxInstrumentLining" useGeneratedKeys="true" keyProperty="id">
insert into wx_instrument_lining
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="instrumentId != null">instrument_id,</if>
<if test="liningId != null">lining_id,</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="instrumentId != null">#{instrumentId},</if>
<if test="liningId != null">#{liningId},</if>
<if test="status != null">#{status},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
</trim>
</insert>
<update id="updateWxInstrumentLining" parameterType="WxInstrumentLining">
update wx_instrument_lining
<trim prefix="SET" suffixOverrides=",">
<if test="instrumentId != null">instrument_id = #{instrumentId},</if>
<if test="liningId != null">lining_id = #{liningId},</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="deleteWxInstrumentLiningById" parameterType="Long">
delete from wx_instrument_lining where id = #{id}
</delete>
<delete id="deleteWxInstrumentLiningByIds" parameterType="String">
delete from wx_instrument_lining where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<delete id="deleteByInstrumentId" parameterType="Long">
delete from wx_instrument_lining where instrument_id = #{instrumentId}
</delete>
</mapper>

@ -13,10 +13,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="status" column="status" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="liningId" column="lining_id" />
</resultMap>
<sql id="selectWxInstrumentModeVo">
select id, instrument_id, mode_id, mode_sort, is_new, status, create_by, create_time from wx_instrument_mode
select id, instrument_id, mode_id, mode_sort, is_new, status, create_by, create_time, lining_id from wx_instrument_mode
</sql>
<select id="selectWxInstrumentModeList" parameterType="WxInstrumentMode" resultMap="WxInstrumentModeResult">
@ -26,6 +27,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="modeId != null "> and mode_id = #{modeId}</if>
<if test="isNew != null "> and is_new = #{isNew}</if>
<if test="status != null "> and status = #{status}</if>
<if test="liningId != null "> and lining_id = #{liningId}</if>
</where>
order by mode_sort asc
</select>
@ -45,6 +47,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="status != null">status,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="liningId != null">lining_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="instrumentId != null">#{instrumentId},</if>
@ -54,6 +57,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="status != null">#{status},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="liningId != null">#{liningId},</if>
</trim>
</insert>
@ -67,6 +71,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<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="liningId != null">lining_id = #{liningId},</if>
</trim>
where id = #{id}
</update>

@ -0,0 +1,109 @@
<?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.WxLiningMapper">
<resultMap type="WxLining" id="WxLiningResult">
<result property="id" column="id" />
<result property="code" column="code" />
<result property="name" column="name" />
<result property="desc" column="desc" />
<result property="isShowBuy" column="is_show_buy" />
<result property="skipAppid" column="skip_appid" />
<result property="skipPath" column="skip_path" />
<result property="icon" column="icon" />
<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" />
</resultMap>
<sql id="selectWxLiningVo">
select id, code, name, `desc`, is_show_buy, skip_appid, skip_path, icon, status, create_by, create_time, update_by, update_time from wx_lining
</sql>
<select id="selectWxLiningList" parameterType="WxLining" resultMap="WxLiningResult">
<include refid="selectWxLiningVo"/>
<where>
<if test="code != null and code != ''"> and code = #{code}</if>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="desc != null and desc != ''"> and `desc` = #{desc}</if>
<if test="isShowBuy != null "> and is_show_buy = #{isShowBuy}</if>
<if test="skipAppid != null and skipAppid != ''"> and skip_appid = #{skipAppid}</if>
<if test="skipPath != null and skipPath != ''"> and skip_path = #{skipPath}</if>
<if test="icon != null and icon != ''"> and icon = #{icon}</if>
<if test="status != null "> and status = #{status}</if>
</where>
</select>
<select id="selectWxLiningById" parameterType="Long" resultMap="WxLiningResult">
<include refid="selectWxLiningVo"/>
where id = #{id}
</select>
<insert id="insertWxLining" parameterType="WxLining">
insert into wx_lining
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="code != null">code,</if>
<if test="name != null">name,</if>
<if test="desc != null">`desc`,</if>
<if test="isShowBuy != null">is_show_buy,</if>
<if test="skipAppid != null">skip_appid,</if>
<if test="skipPath != null">skip_path,</if>
<if test="icon != null">icon,</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>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="code != null">#{code},</if>
<if test="name != null">#{name},</if>
<if test="desc != null">#{desc},</if>
<if test="isShowBuy != null">#{isShowBuy},</if>
<if test="skipAppid != null">#{skipAppid},</if>
<if test="skipPath != null">#{skipPath},</if>
<if test="icon != null">#{icon},</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>
</trim>
</insert>
<update id="updateWxLining" parameterType="WxLining">
update wx_lining
<trim prefix="SET" suffixOverrides=",">
<if test="code != null">code = #{code},</if>
<if test="name != null">name = #{name},</if>
<if test="desc != null">`desc` = #{desc},</if>
<if test="isShowBuy != null">is_show_buy = #{isShowBuy},</if>
<if test="skipAppid != null">skip_appid = #{skipAppid},</if>
<if test="skipPath != null">skip_path = #{skipPath},</if>
<if test="icon != null">icon = #{icon},</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>
</trim>
where id = #{id}
</update>
<delete id="deleteWxLiningById" parameterType="Long">
delete from wx_lining where id = #{id}
</delete>
<delete id="deleteWxLiningByIds" parameterType="String">
delete from wx_lining where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

@ -74,8 +74,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
FROM
wx_mode mo
LEFT JOIN `wx_instrument_mode` imo ON imo.mode_id = mo.id
WHERE
imo.instrument_id = #{instrumentId}
<where>
<if test="instrumentId != null "> and imo.instrument_id = #{instrumentId}</if>
<if test="liningId != null "> and imo.lining_id = #{liningId}</if>
</where>
ORDER BY imo.mode_sort ASC
</select>

@ -66,6 +66,11 @@
<artifactId>flossom-common-swagger</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-mock</artifactId>
<version>2.0.8</version>
</dependency>
</dependencies>
<build>

@ -2,17 +2,24 @@ package com.flossom.file.controller;
import com.flossom.common.core.domain.SysFile;
import com.flossom.file.service.ISysFileService;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mock.web.MockMultipartFile;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import com.flossom.common.core.domain.R;
import com.flossom.common.core.utils.file.FileUtils;
import javax.annotation.Nullable;
import java.util.Objects;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.StandardCopyOption;
import java.util.UUID;
/**
*
@ -20,8 +27,7 @@ import java.util.Objects;
* @author flossom
*/
@RestController
public class SysFileController
{
public class SysFileController {
private static final Logger log = LoggerFactory.getLogger(SysFileController.class);
@Autowired
@ -31,20 +37,20 @@ public class SysFileController
*
*/
@PostMapping("upload")
public R<SysFile> upload(MultipartFile file)
{
try
{
public R<SysFile> upload(@RequestParam("file") MultipartFile file) {
try {
// 上传并返回访问地址
log.info("文件上传前名称:{}", file.getOriginalFilename());
file = renameFile(file, UUID.randomUUID().toString().replace("-",""));
System.out.println("文件上传开始");
String url = sysFileService.uploadFile(file);
SysFile sysFile = new SysFile();
sysFile.setName(FileUtils.getName(url));
String fileName = FileUtils.getName(url);
log.info("重置文件名:{}", fileName);
sysFile.setName(fileName);
sysFile.setUrl(url);
return R.ok(sysFile);
}
catch (Exception e)
{
} catch (Exception e) {
log.error("上传文件失败", e);
return R.fail(e.getMessage());
}
@ -54,24 +60,52 @@ public class SysFileController
*
*/
@PostMapping("upload/else")
public R<SysFile> upload(MultipartFile file, int index, String condition)
{
try
{
public R<SysFile> upload(@RequestParam("file") MultipartFile file, int index, String condition) {
try {
// 上传并返回访问地址
log.info("文件上传前名称:{}", file.getOriginalFilename());
file = renameFile(file, UUID.randomUUID().toString().replace("-",""));
System.out.println("文件上传开始");
String url = sysFileService.uploadFile(file);
SysFile sysFile = new SysFile();
sysFile.setName(FileUtils.getName(url));
String fileName = FileUtils.getName(url);
log.info("重置文件名:{}", fileName);
sysFile.setName(fileName);
sysFile.setUrl(url);
sysFile.setIndex(index);
sysFile.setCondition(condition);
return R.ok(sysFile);
}
catch (Exception e)
{
} catch (Exception e) {
log.error("上传文件失败", e);
return R.fail(e.getMessage());
}
}
public MultipartFile renameFile(MultipartFile originalFile, String newFileName) throws IOException {
if (originalFile == null || StringUtils.isEmpty(newFileName)) {
throw new IllegalArgumentException("Original file and new file name must not be null or empty.");
}
// Create a temporary file to store the renamed content
File tempFile = File.createTempFile("temp-", ".tmp");
Path tempFilePath = tempFile.toPath();
// Copy the content of the original MultipartFile to the temporary file
Files.copy(originalFile.getInputStream(), tempFilePath, StandardCopyOption.REPLACE_EXISTING);
// Generate the new file name
String originalFileName = originalFile.getOriginalFilename();
String fileExtension = originalFileName.substring(originalFileName.lastIndexOf("."));
String finalFileName = newFileName + fileExtension;
// Rename the temporary file
File renamedFile = new File(tempFile.getParent(), finalFileName);
Files.move(tempFilePath, renamedFile.toPath(), StandardCopyOption.REPLACE_EXISTING);
// Create a new MultipartFile from the renamed file
return new MockMultipartFile(renamedFile.getName(), renamedFile.getName(),
originalFile.getContentType(), Files.readAllBytes(renamedFile.toPath()));
}
}

@ -27,4 +27,4 @@ spring:
multipart:
enabled: true #默认支持文件上传
max-file-size: 50MB #最大文件
max-request-size: 30MB #最大支持请求大小
max-request-size: 50MB #最大支持请求大小

@ -101,6 +101,15 @@
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<!-- 数云SDK -->
<dependency>
<groupId>com.shuyun.open</groupId>
<artifactId>open-platform-sdk</artifactId>
<version>1.0.1</version>
<scope>system</scope>
<systemPath>${project.basedir}/src/main/resources/lib/open-platform-sdk-1.0.1.jar</systemPath>
</dependency>
</dependencies>
<build>
@ -109,6 +118,17 @@
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<!-- 将 resources 目录下的 第三方jar 打包到 自己的 jar 包中 -->
<includeSystemScope>true</includeSystemScope>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

@ -134,8 +134,9 @@ public class WxInstrumentController extends BaseController {
* ID
*/
@GetMapping(value = "/modeInfoList")
public R modeInfo(@NotNull(message = "仪器ID不能为空") @RequestParam("instrumentId") Long instrumentId) {
return R.ok(wxInstrumentService.getInstrumentModeByInstrumentId(instrumentId));
public R modeInfo(@NotNull(message = "仪器ID不能为空") @RequestParam("instrumentId") Long instrumentId,
@RequestParam(value = "liningId", required = false) Long liningId) {
return R.ok(wxInstrumentService.getInstrumentModeByInstrumentId(instrumentId, liningId));
}
/**

@ -0,0 +1,31 @@
package com.flossom.miniProgram.controller;
import com.flossom.common.core.domain.R;
import com.flossom.common.core.web.controller.BaseController;
import com.flossom.miniProgram.service.IWxLiningService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.validation.constraints.NotNull;
/**
* Controller
*/
@RestController
@RequestMapping("/lining")
public class WxLiningController extends BaseController {
@Autowired
private IWxLiningService wxLiningService;
/**
*
*/
@GetMapping("/list")
public R list(@RequestParam @NotNull(message = "仪器ID不能为空") Long instrumentId) {
return R.ok(wxLiningService.selectWxLiningList(instrumentId));
}
}

@ -1,13 +1,12 @@
package com.flossom.miniProgram.controller;
import com.flossom.common.core.domain.entity.WxUserIntegralLog;
import com.flossom.common.core.web.controller.BaseController;
import com.flossom.common.core.web.page.TableDataInfo;
import com.flossom.miniProgram.service.IWxUserIntegralService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import javax.validation.constraints.NotNull;
/**
* Controller
@ -29,10 +28,9 @@ public class WxUserIntegralController extends BaseController {
* @return
*/
@GetMapping("/obtainUserIntegral")
public TableDataInfo obtainUserIntegral() {
startPage();
List<WxUserIntegralLog> list = wxUserIntegralLogService.obtainUserIntegral();
return getDataTable(list);
public TableDataInfo obtainUserIntegral(@NotNull(message = "pageSize 不能为空") @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
@NotNull(message = "pageNum 不能为空") @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
return wxUserIntegralLogService.obtainUserIntegral(pageNum, pageSize);
}
}

@ -25,7 +25,7 @@ public interface IWxInstrumentService {
List<WxInstrumentFileRelate> getInstrumentFileRelateByInstrumentId(Long instrumentId, Integer classify);
List<WxModeRet> getInstrumentModeByInstrumentId(Long instrumentId);
List<WxModeRet> getInstrumentModeByInstrumentId(Long instrumentId, Long liningId);
WxInstrumentSerial determineSerialIsSameInstrument(String serial, Long instrumentId);

@ -0,0 +1,20 @@
package com.flossom.miniProgram.service;
import com.flossom.common.core.domain.entity.WxLining;
import java.util.List;
/**
* Service
*/
public interface IWxLiningService {
/**
*
*
* @param wxLining
* @return
*/
public List<WxLining> selectWxLiningList(Long instrumentId);
}

@ -1,11 +1,9 @@
package com.flossom.miniProgram.service;
import com.flossom.common.core.domain.entity.WxUserIntegralLog;
import java.util.List;
import com.flossom.common.core.web.page.TableDataInfo;
public interface IWxUserIntegralService {
List<WxUserIntegralLog> obtainUserIntegral();
TableDataInfo obtainUserIntegral(Integer pageNum, Integer pageSize);
}

@ -1,14 +1,20 @@
package com.flossom.miniProgram.service.impl;
import com.flossom.common.core.constant.IntegralChangTextConstants;
import com.flossom.common.core.domain.entity.*;
import com.flossom.common.core.domain.req.WxClockLogReq;
import com.flossom.common.core.domain.ret.WxClockLogRet;
import com.flossom.common.core.domain.shuyun.ShuYunPointChange;
import com.flossom.common.core.enums.IntegralChangeTypeEnum;
import com.flossom.common.core.enums.ShuYunPointSourceEnum;
import com.flossom.common.core.enums.Status;
import com.flossom.common.core.mapper.*;
import com.flossom.common.core.utils.DateUtils;
import com.flossom.common.core.utils.uuid.IdUtils;
import com.flossom.common.security.utils.SecurityUtils;
import com.flossom.miniProgram.service.IWxClockLogService;
import com.flossom.miniProgram.utils.shuyun.ShuYunApiUtils;
import com.flossom.miniProgram.utils.shuyun.ShuYunConfig;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
@ -23,6 +29,7 @@ import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
@ -63,6 +70,9 @@ public class WxClockLogServiceImpl implements IWxClockLogService {
@Value("${rank.clock.redisKey}")
private String CLOCK_RANK_REDIS_KEY;
@Autowired
private ShuYunConfig shuYunConfig;
@Override
@Transactional
@ -77,10 +87,13 @@ public class WxClockLogServiceImpl implements IWxClockLogService {
queryClockLog.getParams().put("endTime", LocalDateTime.of(now.toLocalDate(), LocalTime.MAX));
List<WxClockLog> wxClockLogList = wxClockLogMapper.selectWxClockLogList(queryClockLog);
WxClockLog wxClockLog = new WxClockLog();
Boolean isFirstClock = false;
Integer firstClockCredit = 0;
if (wxClockLogList != null && wxClockLogList.size() == 1) {
// 打卡记录一天只有一条
wxClockLog.setId(wxClockLogList.get(0).getId());
} else {
isFirstClock = true;
IntegralClock integralClock = integralClockMapper.selectIntegralClockById(1L);
// 日常奖励加分
Long credit = integralClock.getDailyClockCredit();
@ -93,6 +106,7 @@ public class WxClockLogServiceImpl implements IWxClockLogService {
}
}
if (credit != null && credit != 0) {
firstClockCredit = credit.intValue();
// 增加积分
WxUserMember query = wxUserMemberMapper.selectWxUserMemberById(wxUserMember.getId());
WxUserMember updateEntity = new WxUserMember();
@ -113,11 +127,6 @@ public class WxClockLogServiceImpl implements IWxClockLogService {
wxUserIntegralLog.setCreateBy(SecurityUtils.getLoginUser().getWxUserMember().getNickname());
wxUserIntegralLog.setCreateTime(DateUtils.getNowDate());
wxUserIntegralLogMapper.insertWxUserIntegralLog(wxUserIntegralLog);
/**
* TODO
*/
}
}
wxClockLog.setClockContent(wxClockLogReq.getClockContent());
@ -200,6 +209,16 @@ public class WxClockLogServiceImpl implements IWxClockLogService {
wxClockImgMapper.insertWxClockImg(wxClockImg);
}
}
if (isFirstClock && firstClockCredit != null && firstClockCredit > 0) {
/**
* TODO
*/
ShuYunPointChange shuYunPointChange = new ShuYunPointChange(wxUserMember.getUnionid(), shuYunConfig.getPlatCode(), shuYunConfig.getShopId(),
IdUtils.generateSequence(), ShuYunPointSourceEnum.OTHER.getSource(), firstClockCredit,
LocalDateTime.now().format(DateTimeFormatter.ofPattern(DateUtils.YYYY_MM_DD_HH_MM_SS)), IntegralChangTextConstants.DAILY_CLOCK);
ShuYunApiUtils.pointChange(shuYunPointChange);
}
}
@Override

@ -1,17 +1,22 @@
package com.flossom.miniProgram.service.impl;
import com.alibaba.fastjson.JSON;
import com.flossom.common.core.constant.IntegralChangTextConstants;
import com.flossom.common.core.domain.entity.*;
import com.flossom.common.core.domain.ret.WxBindingInstrumentInfo;
import com.flossom.common.core.domain.ret.WxModeRet;
import com.flossom.common.core.domain.shuyun.ShuYunPointChange;
import com.flossom.common.core.enums.*;
import com.flossom.common.core.exception.ServiceException;
import com.flossom.common.core.exception.ServiceReturnCodeException;
import com.flossom.common.core.mapper.*;
import com.flossom.common.core.utils.DateUtils;
import com.flossom.common.core.utils.StringUtils;
import com.flossom.common.core.utils.uuid.IdUtils;
import com.flossom.common.security.utils.SecurityUtils;
import com.flossom.miniProgram.service.IWxInstrumentService;
import com.flossom.miniProgram.utils.shuyun.ShuYunApiUtils;
import com.flossom.miniProgram.utils.shuyun.ShuYunConfig;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
@ -27,6 +32,7 @@ import java.time.Instant;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoField;
import java.util.*;
import java.util.stream.Collectors;
@ -90,6 +96,9 @@ public class WxInstrumentServiceImpl implements IWxInstrumentService {
@Autowired
private WxModeGearMapper wxModeGearMapper;
@Autowired
private ShuYunConfig shuYunConfig;
@Override
public List<WxInstrument> bindingInstrumentList() {
/* 绑定了的仪器 不受 "可见小程序标签/可见外部标签" 影响, 去除仪器隐藏的 */
@ -318,8 +327,12 @@ public class WxInstrumentServiceImpl implements IWxInstrumentService {
logger.info("绑定成功,序列号:{}用户ID{},用户名:{}", serial, wxUserMember.getId(), wxUserMember.getNickname());
/**
* TODO:
* TODO:
*/
ShuYunPointChange shuYunPointChange = new ShuYunPointChange(wxUserMember.getUnionid(), shuYunConfig.getPlatCode(), shuYunConfig.getShopId(),
IdUtils.generateSequence(), ShuYunPointSourceEnum.OTHER.getSource(), wxInstrument.getBindingCredit(),
LocalDateTime.now().format(DateTimeFormatter.ofPattern(DateUtils.YYYY_MM_DD_HH_MM_SS)), wxInstrument.getName() + IntegralChangTextConstants.BINDING_INSTRUMENT);
ShuYunApiUtils.pointChange(shuYunPointChange);
}
}
}
@ -434,7 +447,7 @@ public class WxInstrumentServiceImpl implements IWxInstrumentService {
}
@Override
public List<WxModeRet> getInstrumentModeByInstrumentId(Long instrumentId) {
public List<WxModeRet> getInstrumentModeByInstrumentId(Long instrumentId, Long liningId) {
// 用户拥有的标签
WxUserTag wxUserTag = new WxUserTag();
wxUserTag.setUserId(SecurityUtils.getLoginUser().getWxUserMember().getId());
@ -447,7 +460,7 @@ public class WxInstrumentServiceImpl implements IWxInstrumentService {
}
// 查询仪器关联的所有模式
List<WxModeRet> wxModeRetList = new ArrayList<>();
List<WxMode> wxModeList = wxModeMapper.selectListByInstrumentId(instrumentId);
List<WxMode> wxModeList = wxModeMapper.selectListByInstrumentId(instrumentId, liningId);
for (WxMode wxMode : wxModeList) {
// 判断每个模式是否加锁
WxModeRet wxModeRet = new WxModeRet();
@ -457,7 +470,9 @@ public class WxInstrumentServiceImpl implements IWxInstrumentService {
BeanUtils.copyProperties(wxMode, wxModeRet);
if (wxMode.getInstrumentType() == 2) {
// IOT仪器才可以设置模式时长
wxModeRet.setModeTime(LocalTime.of(0, wxMode.getModeTime()));
if (wxMode.getModeTime() != null) {
wxModeRet.setModeTime(LocalTime.ofSecondOfDay(wxMode.getModeTime()));
}
}
Boolean isLock = false;
if (wxModeTagList != null && wxModeTagList.size() > 0) {

@ -0,0 +1,50 @@
package com.flossom.miniProgram.service.impl;
import com.flossom.common.core.domain.entity.WxInstrumentLining;
import com.flossom.common.core.domain.entity.WxLining;
import com.flossom.common.core.mapper.WxInstrumentLiningMapper;
import com.flossom.common.core.mapper.WxLiningMapper;
import com.flossom.miniProgram.service.IWxLiningService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
/**
* Service
*
* @author flossom
* @date 2024-03-26
*/
@Service
public class WxLiningServiceImpl implements IWxLiningService {
@Autowired
private WxLiningMapper wxLiningMapper;
@Autowired
private WxInstrumentLiningMapper wxInstrumentLiningMapper;
/**
*
*
* @param wxLining
* @return
*/
@Override
public List<WxLining> selectWxLiningList(Long instrumentId) {
WxInstrumentLining instrumentLiningQuery = new WxInstrumentLining();
instrumentLiningQuery.setInstrumentId(instrumentId);
List<WxInstrumentLining> wxInstrumentLiningList = wxInstrumentLiningMapper.selectWxInstrumentLiningList(instrumentLiningQuery);
if (wxInstrumentLiningList != null && wxInstrumentLiningList.size() > 0) {
List<WxLining> liningList = new ArrayList<>();
for (WxInstrumentLining wxInstrumentLining : wxInstrumentLiningList) {
liningList.add(wxLiningMapper.selectWxLiningById(wxInstrumentLining.getLiningId()));
}
return liningList;
}
return null;
}
}

@ -1,25 +1,78 @@
package com.flossom.miniProgram.service.impl;
import com.flossom.common.core.constant.HttpStatus;
import com.flossom.common.core.domain.entity.WxUserIntegralLog;
import com.flossom.common.core.domain.entity.WxUserMember;
import com.flossom.common.core.domain.shuyun.ShuYunPageReq;
import com.flossom.common.core.domain.shuyun.ShuYunPageUtil;
import com.flossom.common.core.domain.shuyun.ShuYunPointChangeLog;
import com.flossom.common.core.enums.IntegralChangeTypeEnum;
import com.flossom.common.core.exception.ServiceException;
import com.flossom.common.core.mapper.WxUserIntegralLogMapper;
import com.flossom.common.core.utils.DateUtils;
import com.flossom.common.core.web.page.TableDataInfo;
import com.flossom.common.security.utils.SecurityUtils;
import com.flossom.miniProgram.service.IWxUserIntegralService;
import com.flossom.miniProgram.utils.shuyun.ShuYunApiUtils;
import com.flossom.miniProgram.utils.shuyun.ShuYunConfig;
import com.github.pagehelper.PageInfo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
@Service
public class WxUserIntegralServiceImpl implements IWxUserIntegralService {
protected final Logger logger = LoggerFactory.getLogger(this.getClass());
@Autowired
private WxUserIntegralLogMapper wxUserIntegralLogMapper;
@Autowired
private ShuYunConfig shuYunConfig;
@Override
public List<WxUserIntegralLog> obtainUserIntegral() {
public TableDataInfo obtainUserIntegral(Integer pageNum, Integer pageSize) {
/**
* TODO:
*/
WxUserMember wxUserMember = SecurityUtils.getLoginUser().getWxUserMember();
return wxUserIntegralLogMapper.obtainUserIntegral(wxUserMember.getId());
ShuYunPageReq req = new ShuYunPageReq(SecurityUtils.getLoginUser().getWxUserMember().getUnionid(), shuYunConfig.getPlatCode(), shuYunConfig.getShopId(),
String.valueOf(pageSize), String.valueOf(pageNum));
ShuYunPageUtil<ShuYunPointChangeLog> pointChangeLogShuYunPageUtil = ShuYunApiUtils.pointChangeLogSearch(req);
if (pointChangeLogShuYunPageUtil == null) {
logger.error("积分查询失败用户id{},用户名:{}用户unionid{}分页参数pageNum={}pageSize={}",
wxUserMember.getId(), wxUserMember.getNickname(), wxUserMember.getUnionid(), pageNum, pageSize);
throw new ServiceException("积分查询失败");
}
List<WxUserIntegralLog> userIntegralLogList = new ArrayList<>();
WxUserIntegralLog userIntegralLog = null;
if (pointChangeLogShuYunPageUtil.getList() != null && pointChangeLogShuYunPageUtil.getList().size() > 0) {
for (ShuYunPointChangeLog shuYunPointChangeLog : pointChangeLogShuYunPageUtil.getList()) {
userIntegralLog = new WxUserIntegralLog();
userIntegralLog.setRemarkContent(shuYunPointChangeLog.getDesc());
// 变更积分
if (Integer.valueOf(shuYunPointChangeLog.getChangePoint()) > 0) {
userIntegralLog.setSource(IntegralChangeTypeEnum.INCREASE.getCode());
} else {
userIntegralLog.setSource(IntegralChangeTypeEnum.REDUCE.getCode());
}
userIntegralLog.setFloatScore(Math.abs(Long.valueOf(shuYunPointChangeLog.getChangePoint())));
// 变更时间
userIntegralLog.setCreateTime(DateUtils.parseDate(shuYunPointChangeLog.getCreated()));
}
userIntegralLogList.add(userIntegralLog);
}
TableDataInfo rspData = new TableDataInfo();
rspData.setCode(HttpStatus.SUCCESS);
rspData.setRows(userIntegralLogList);
rspData.setMsg("查询成功");
rspData.setTotal(pointChangeLogShuYunPageUtil.getTotals());
return rspData;
}
}

@ -3,21 +3,28 @@ package com.flossom.miniProgram.service.impl;
import com.alibaba.fastjson.JSON;
import com.flossom.common.core.constant.CacheConstants;
import com.flossom.common.core.constant.HttpStatus;
import com.flossom.common.core.constant.IntegralChangTextConstants;
import com.flossom.common.core.constant.UserConstants;
import com.flossom.common.core.domain.R;
import com.flossom.common.core.domain.entity.*;
import com.flossom.common.core.domain.shuyun.ShuYunMember;
import com.flossom.common.core.domain.shuyun.ShuYunPointChange;
import com.flossom.common.core.enums.IntegralChangeTypeEnum;
import com.flossom.common.core.enums.MessageTypeEnum;
import com.flossom.common.core.enums.ShuYunPointSourceEnum;
import com.flossom.common.core.enums.WxUserIntegralMessageTypeEnum;
import com.flossom.common.core.exception.ServiceException;
import com.flossom.common.core.mapper.*;
import com.flossom.common.core.utils.DateUtils;
import com.flossom.common.core.utils.StringUtils;
import com.flossom.common.core.utils.uuid.IdUtils;
import com.flossom.common.redis.service.RedisService;
import com.flossom.common.security.utils.SecurityUtils;
import com.flossom.miniProgram.domain.vo.*;
import com.flossom.miniProgram.service.IWxUserMemberService;
import com.flossom.miniProgram.utils.MiniProgramUtils;
import com.flossom.miniProgram.utils.shuyun.ShuYunApiUtils;
import com.flossom.miniProgram.utils.shuyun.ShuYunConfig;
import com.flossom.system.api.RemoteAuthService;
import com.flossom.system.api.model.LoginUser;
import org.slf4j.Logger;
@ -28,6 +35,8 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
@ -61,6 +70,9 @@ public class WxUserMemberServiceImpl implements IWxUserMemberService {
@Autowired
private WxUserIntegralLogMapper wxUserIntegralLogMapper;
@Autowired
private ShuYunConfig shuYunConfig;
@Override
@Transactional
@ -176,8 +188,11 @@ public class WxUserMemberServiceImpl implements IWxUserMemberService {
}
/**
* TODO:
* TODO: 1
*/
WxUserMember wxUserMember = wxUserMemberMapper.selectWxUserMemberById(SecurityUtils.getLoginUser().getWxUserMember().getId());
ShuYunApiUtils.registerMember(new ShuYunMember(wxUserMember.getUnionid(), shuYunConfig.getPlatCode(), shuYunConfig.getShopId(),
"用户" + wxUserMember.getId(), wxUserMember.getMobile(), DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, wxUserMember.getCreateTime())));
return wxCode2PhoneRet.getPhoneInfo().getPhoneNumber();
}
@ -189,15 +204,13 @@ public class WxUserMemberServiceImpl implements IWxUserMemberService {
if (wxUserMember == null) {
throw new ServiceException("用户不存在");
}
int floatScore = 0;
List<IntegralGlobal> integralGlobalList = integralGlobalMapper.selectIntegralGlobalList(new IntegralGlobal());
IntegralGlobal integralGlobal = integralGlobalList.get(0);
Boolean isCompleteInformation = false;
if (wxUserMember.getIsCompleteInformation() == null || wxUserMember.getIsCompleteInformation() == 0) {
isCompleteInformation = true;
// 修改完善状态
wxUserMember.setIsCompleteInformation(1);
List<IntegralGlobal> integralGlobalList = integralGlobalMapper.selectIntegralGlobalList(new IntegralGlobal());
IntegralGlobal integralGlobal = integralGlobalList.get(0);
floatScore = integralGlobal.getIntegral().intValue();
wxUserMember.setCredit(wxUserMember.getCredit() + integralGlobal.getIntegral().intValue());
// 保存积分详情
@ -212,7 +225,7 @@ public class WxUserMemberServiceImpl implements IWxUserMemberService {
wxUserIntegralLog.setCreateTime(DateUtils.getNowDate());
wxUserIntegralLogMapper.insertWxUserIntegralLog(wxUserIntegralLog);
// 2.4、用户注册成功发送消息
// 2.4、用户升级会员成功发送消息
WxScriptMessage wxScriptMessage = wxScriptMessageMapper.selectOneByMessageType(MessageTypeEnum.COMPLETE_USER_INFORMATION.getCode());
if (wxScriptMessage != null) {
WxUserScriptLog wxUserScriptLog = new WxUserScriptLog();
@ -229,17 +242,31 @@ public class WxUserMemberServiceImpl implements IWxUserMemberService {
wxUserScriptLog.setUpdateBy(null);
wxUserScriptLogMapper.insertWxUserScriptLog(wxUserScriptLog);
}
// TODO 首次完善,增加加分 (对接数云未完成)
}
BeanUtils.copyProperties(userMemberUpdateVo, wxUserMember);
wxUserMember.setUpdateTime(DateUtils.getNowDate());
wxUserMemberMapper.updateWxUserMember(wxUserMember);
// 刷新用户信息
// 首次完善用户信息,增加积分,刷新了缓存
LoginUserVo loginUserVo = refreshWxUserInfo();
// TODO 2、更新用户信息同步到数云 (已完成,未保存记录)
// 1、完善用户信息
ShuYunMember member = new ShuYunMember();
member.setId(wxUserMember.getUnionid());
member.setPlatCode(shuYunConfig.getPlatCode());
member.setShopId(shuYunConfig.getShopId());
member.setName(userMemberUpdateVo.getNickname());
member.setBirthday(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, userMemberUpdateVo.getBirthday()));
ShuYunApiUtils.modifyMember(member);
if (isCompleteInformation) {
loginUserVo.setIntegralText("您已完善个人信息,获得" + floatScore + "积分");
loginUserVo.setIntegralText("您已完善个人信息,获得" + integralGlobal.getIntegral().intValue() + "积分");
// TODO 3、首次完善通知数云增加积分 (已完成,未保存记录)
// 2、完善会员信息增加积分
ShuYunPointChange shuYunPointChange = new ShuYunPointChange(wxUserMember.getUnionid(), shuYunConfig.getPlatCode(), shuYunConfig.getShopId(),
IdUtils.generateSequence(), ShuYunPointSourceEnum.OTHER.getSource(), integralGlobal.getIntegral().intValue(),
LocalDateTime.now().format(DateTimeFormatter.ofPattern(DateUtils.YYYY_MM_DD_HH_MM_SS)), IntegralChangTextConstants.COMPLETE_INFORMATION);
ShuYunApiUtils.pointChange(shuYunPointChange);
}
return loginUserVo;
}
@ -250,7 +277,7 @@ public class WxUserMemberServiceImpl implements IWxUserMemberService {
* @return
*/
@Override
@Transactional(propagation = Propagation.SUPPORTS)
@Transactional(propagation = Propagation.NOT_SUPPORTED)
public LoginUserVo refreshWxUserInfo() {
LoginUser loginUser = SecurityUtils.getLoginUser();
@ -266,6 +293,14 @@ public class WxUserMemberServiceImpl implements IWxUserMemberService {
BeanUtils.copyProperties(wxUserMember, loginUserVo);
loginUserVo.setToken(null);
loginUserVo.setIntegralText(null);
// TODO:调用数云接口获取最新的积分值(已完成,未保存操作记录)
if (wxUserMember.getUserType() != null && wxUserMember.getUserType() == 1) {
ShuYunMember shuYunMember = ShuYunApiUtils.queryMember(wxUserMember.getUnionid(), shuYunConfig.getPlatCode(), shuYunConfig.getShopId());
loginUserVo.setCredit(Integer.valueOf(shuYunMember.getPoint()));
// TODO: 调用数云接口获取即将过期的积分值(已完成,未保存操作记录)
Integer expireCredit = ShuYunApiUtils.pointWillDueSearch(wxUserMember.getUnionid());
loginUserVo.setExpireCredit(expireCredit);
}
// 刷新缓存信息
String userKey = CacheConstants.LOGIN_TOKEN_KEY + loginUser.getToken();

@ -0,0 +1,210 @@
package com.flossom.miniProgram.utils.shuyun;
/**
*
*/
public class ActionMethod {
/**
* token
*/
private String accessToken;
/**
*
*/
private String queryMember;
/**
*
*/
private String registerMember;
/**
*
*/
private String modifyMember;
/**
*
*/
private String modifyMemberMobile;
/**
*
*/
private String unbindMember;
/**
*
*/
private String pointChange;
/**
*
*/
private String pointChangeLogSearch;
/**
*
*/
private String pointWillDueSearch;
/**
*
*/
private String tagCreate;
/**
*
*/
private String tagDelete;
/**
*
*/
private String tagSearch;
/**
*
*/
private String tagUpdate;
/**
*
*/
private String markUserTag;
/**
*
*/
private String deleteUserTag;
/**
*
*/
private String searchUserTag;
public String getAccessToken() {
return accessToken;
}
public void setAccessToken(String accessToken) {
this.accessToken = accessToken;
}
public String getQueryMember() {
return queryMember;
}
public void setQueryMember(String queryMember) {
this.queryMember = queryMember;
}
public String getRegisterMember() {
return registerMember;
}
public void setRegisterMember(String registerMember) {
this.registerMember = registerMember;
}
public String getModifyMember() {
return modifyMember;
}
public void setModifyMember(String modifyMember) {
this.modifyMember = modifyMember;
}
public String getModifyMemberMobile() {
return modifyMemberMobile;
}
public void setModifyMemberMobile(String modifyMemberMobile) {
this.modifyMemberMobile = modifyMemberMobile;
}
public String getUnbindMember() {
return unbindMember;
}
public void setUnbindMember(String unbindMember) {
this.unbindMember = unbindMember;
}
public String getPointChange() {
return pointChange;
}
public void setPointChange(String pointChange) {
this.pointChange = pointChange;
}
public String getPointChangeLogSearch() {
return pointChangeLogSearch;
}
public void setPointChangeLogSearch(String pointChangeLogSearch) {
this.pointChangeLogSearch = pointChangeLogSearch;
}
public String getPointWillDueSearch() {
return pointWillDueSearch;
}
public void setPointWillDueSearch(String pointWillDueSearch) {
this.pointWillDueSearch = pointWillDueSearch;
}
public String getTagCreate() {
return tagCreate;
}
public void setTagCreate(String tagCreate) {
this.tagCreate = tagCreate;
}
public String getTagDelete() {
return tagDelete;
}
public void setTagDelete(String tagDelete) {
this.tagDelete = tagDelete;
}
public String getTagSearch() {
return tagSearch;
}
public void setTagSearch(String tagSearch) {
this.tagSearch = tagSearch;
}
public String getTagUpdate() {
return tagUpdate;
}
public void setTagUpdate(String tagUpdate) {
this.tagUpdate = tagUpdate;
}
public String getMarkUserTag() {
return markUserTag;
}
public void setMarkUserTag(String markUserTag) {
this.markUserTag = markUserTag;
}
public String getDeleteUserTag() {
return deleteUserTag;
}
public void setDeleteUserTag(String deleteUserTag) {
this.deleteUserTag = deleteUserTag;
}
public String getSearchUserTag() {
return searchUserTag;
}
public void setSearchUserTag(String searchUserTag) {
this.searchUserTag = searchUserTag;
}
}

@ -0,0 +1,476 @@
package com.flossom.miniProgram.utils.shuyun;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.map.MapUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.TypeReference;
import com.flossom.common.core.constant.CacheConstants;
import com.flossom.common.core.domain.R;
import com.flossom.common.core.domain.shuyun.*;
import com.flossom.common.core.exception.ServiceException;
import com.flossom.common.core.utils.DateUtils;
import com.flossom.common.redis.service.RedisService;
import com.flossom.miniProgram.utils.HttpClientUtils;
import com.shuyun.open.sdk.bean.HttpMethod;
import com.shuyun.open.sdk.core.GateWayClient;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.time.temporal.TemporalAdjusters;
import java.util.List;
import java.util.Map;
/**
*
*/
@Component
public class ShuYunApiUtils {
protected final static Logger logger = LoggerFactory.getLogger(ShuYunApiUtils.class);
/**
*
*/
private static ShuYunConfig shuYunConfig;
private static RedisService redisService;
@Autowired
public void setShuYunConfig(ShuYunConfig shuYunConfig) {
ShuYunApiUtils.shuYunConfig = shuYunConfig;
}
@Autowired
public void setRedisService(RedisService redisService) {
ShuYunApiUtils.redisService = redisService;
}
/**
* httpcode
*/
public class ShuYunHttpStatusConstants {
/**
*
*/
public static final int SUCCESS = 10000;
/**
*
*
*/
public static final int HALF_SUCCESS = 14000;
}
/**
* accessToken accessToken
*/
public static String getAccessToken() {
Long expiryTime = redisService.getCacheMapValue(CacheConstants.SHUYUN_ACCESS_TOKEN_CACHE, CacheConstants.SHUYUN_ACCESS_TOKEN_CACHE_EXPIRY);
if (expiryTime == null || expiryTime == 0 || LocalDateTime.now().atZone(ZoneId.systemDefault()).toEpochSecond() > expiryTime) {
String accessTokenUrl = StringUtils.replace(shuYunConfig.getActionMethod().getAccessToken(), "{appid}", shuYunConfig.getAppid());
logger.info("刷新 accessToken 地址:{}", accessTokenUrl);
try {
String result = HttpClientUtils.get(accessTokenUrl);
logger.info("请求数云接口获取 accessToken 结果:{}", result);
R r = JSON.parseObject(result, R.class);
if (r.getCode() != R.SUCCESS) {
logger.error("请求数云接口获取accessToken失败将直接使用旧的accessToken失败原因{}", result);
}
} catch (Exception e) {
logger.error("请求数云接口获取accessToken失败将直接使用旧的accessToken失败原因{}", e.getMessage());
}
}
String accessTokenStr = redisService.getCacheMapValue(CacheConstants.SHUYUN_ACCESS_TOKEN_CACHE, CacheConstants.SHUYUN_ACCESS_TOKEN_CACHE_VALUE);
if (StringUtils.isNotBlank(accessTokenStr)) {
AccessToken accessToken = JSON.parseObject(accessTokenStr, AccessToken.class);
return accessToken.getAccessToken();
}
/**
* redis
*/
logger.error("从 redis 获取数云 accessToken 失败,缓存中没有 accessToken有可能是第一次调用");
throw new ServiceException("从 redis 获取数云 accessToken 失败,缓存中没有 accessToken有可能是第一次调用");
}
/**
*
*
* @param httpMethod
* @param queryParams geturl
* @param bodyParams postput
* @param actionMethod
*/
public static <T> R<T> shuYunHttpRequest(HttpMethod httpMethod, Map queryParams, Object bodyParams, String actionMethod, Class<T> clazz) throws ServiceException {
logger.info("数云接口请求地址:{}参数queryParams = {}、bodyParams = {}", actionMethod, queryParams, JSON.toJSONString(bodyParams));
String result = GateWayClient.askGateWay(
httpMethod, shuYunConfig.getUrl(),
queryParams, JSON.toJSONString(bodyParams),
shuYunConfig.getAppid(), shuYunConfig.getSecurity(),
getAccessToken(), actionMethod);
logger.info("返回响应:{}", result);
R<T> r = JSON.parseObject(result, new TypeReference<R<T>>(clazz) {
});
if (r.getCode() == ShuYunHttpStatusConstants.SUCCESS || r.getCode() == ShuYunHttpStatusConstants.HALF_SUCCESS) {
return r;
} else {
logger.error("调用数云接口发生未知错误:{}", result);
throw new ServiceException(r.getMsg());
}
}
/**
*
*/
@Deprecated
public static R shuYunHttpRequest2(HttpMethod httpMethod, Map queryParams, Object bodyParams, String actionMethod) throws ServiceException {
logger.info("数云接口请求地址:{}参数queryParams = {}、bodyParams = {}", actionMethod, queryParams, JSON.toJSONString(bodyParams));
String result = GateWayClient.askGateWay(
httpMethod, shuYunConfig.getUrl(),
queryParams, JSON.toJSONString(bodyParams),
shuYunConfig.getAppid(), shuYunConfig.getSecurity(),
getAccessToken(), actionMethod);
logger.info("返回响应:{}", result);
R r = JSON.parseObject(result, R.class);
if (r.getCode() == ShuYunHttpStatusConstants.SUCCESS || r.getCode() == ShuYunHttpStatusConstants.HALF_SUCCESS) {
return r;
} else {
logger.error("调用数云接口发生未知错误:{}", result);
throw new ServiceException(r.getMsg());
}
}
public static <T> R<T> httpQueryParamsRequest(HttpMethod httpMethod, Map queryParams, String actionMethod, Class<T> clazz) throws ServiceException {
return shuYunHttpRequest(httpMethod, queryParams, null, actionMethod, clazz);
}
public static <T> R<T> httpBodyParamsRequest(HttpMethod httpMethod, Object bodyParams, String actionMethod, Class<T> clazz) throws ServiceException {
return shuYunHttpRequest(httpMethod, null, bodyParams, actionMethod, clazz);
}
/**
*
* https://open.shuyun.com/#/apidoc?type=41&apiId=40
*/
public static R registerMember(ShuYunMember member) {
try {
return httpBodyParamsRequest(HttpMethod.POST, member, shuYunConfig.getActionMethod().getRegisterMember(), Object.class);
} catch (Exception e) {
logger.error("请求数云接口注册会员失败:{}", e.getMessage());
throw new ServiceException("请求数云接口注册会员失败");
}
}
/**
*
* https://open.shuyun.com/#/apidoc?type=41&apiId=149
*/
public static ShuYunMember queryMember(String memberId, String platCode, String shopId) {
Map<String, String> params = MapUtil.newHashMap();
params.put("id", memberId);
params.put("platCode", platCode);
params.put("shopId", shopId);
try {
R<ShuYunMember> r = httpBodyParamsRequest(HttpMethod.POST, params, shuYunConfig.getActionMethod().getQueryMember(), ShuYunMember.class);
if (r.getCode() == ShuYunHttpStatusConstants.SUCCESS) {
return r.getData();
}
if (r.getCode() == ShuYunHttpStatusConstants.HALF_SUCCESS) {
return null;
}
logger.error("请求数云接口-会员信息查询失败:{}", r.getMsg());
throw new ServiceException("请求数云接口-会员信息查询失败");
} catch (Exception e) {
logger.error("请求数云接口-会员信息查询失败:{}", e.getMessage());
throw new ServiceException("请求数云接口-会员信息查询失败");
}
}
/**
*
*
* https://open.shuyun.com/#/apidoc?type=41&apiId=36
*/
public static R modifyMember(ShuYunMember member) {
try {
return httpBodyParamsRequest(HttpMethod.PUT, member, shuYunConfig.getActionMethod().getModifyMember(), Object.class);
} catch (Exception e) {
logger.error("请求数云接口-修改会员信息(除手机号)失败:{}", e.getMessage());
throw new ServiceException("请求数云接口-修改会员信息(除手机号)失败");
}
}
/**
*
* https://open.shuyun.com/#/apidoc?type=41&apiId=37
*/
public static R modifyMemberMobile(String memberId, String platCode, String shopId, String mobile) {
Map<String, String> params = MapUtil.newHashMap();
params.put("id", memberId);
params.put("platCode", platCode);
params.put("shopId", shopId);
params.put("mobile", mobile);
try {
return httpBodyParamsRequest(HttpMethod.PUT, params, shuYunConfig.getActionMethod().getModifyMemberMobile(), Object.class);
} catch (Exception e) {
logger.error("请求数云接口-修改会员手机号失败:{}", e.getMessage());
throw new ServiceException("请求数云接口-修改会员手机号失败");
}
}
/**
*
* https://open.shuyun.com/#/apidoc?type=41&apiId=74
*/
public static R unbindMember(String memberId, String platCode, String shopId) {
Map<String, String> params = MapUtil.newHashMap();
params.put("id", memberId);
params.put("platCode", platCode);
params.put("shopId", shopId);
try {
return httpBodyParamsRequest(HttpMethod.POST, params, shuYunConfig.getActionMethod().getUnbindMember(), Object.class);
} catch (Exception e) {
logger.error("请求数云接口-解绑会员失败:{}", e.getMessage());
throw new ServiceException("请求数云接口-解绑会员失败");
}
}
/**
*
* https://open.shuyun.com/#/apidoc?type=41&apiId=34
*/
public static R pointChange(ShuYunPointChange shuYunPointChange) {
try {
return httpBodyParamsRequest(HttpMethod.POST, shuYunPointChange, shuYunConfig.getActionMethod().getPointChange(), Object.class);
} catch (Exception e) {
logger.error("请求数云接口-会员积分变更失败:{}", e.getMessage());
throw new ServiceException("请求数云接口-会员积分变更失败");
}
}
/**
* ()
* https://open.shuyun.com/#/apidoc?type=41&apiId=33
*/
public static ShuYunPageUtil<ShuYunPointChangeLog> pointChangeLogSearch(ShuYunPageReq shuYunPageReq) {
try {
R r = httpQueryParamsRequest(HttpMethod.GET, BeanUtil.beanToMap(shuYunPageReq),
shuYunConfig.getActionMethod().getPointChangeLogSearch(), Object.class);
if (r.getCode() == ShuYunHttpStatusConstants.HALF_SUCCESS) {
logger.info("查询成功,没有数据");
return new ShuYunPageUtil<>();
}
if (r.getCode() != ShuYunHttpStatusConstants.SUCCESS) {
logger.error("请求数云接口-会员积分变更记录查询失败:{}", r.getMsg());
}
return JSON.parseObject(r.getData().toString(), new TypeReference<ShuYunPageUtil<ShuYunPointChangeLog>>() {
});
} catch (Exception e) {
logger.error("请求数云接口-会员积分变更记录查询失败:{}", e.getMessage());
throw new ServiceException("请求数云接口-会员积分变更记录查询失败");
}
}
/**
*
* https://open.shuyun.com/#/apidoc?type=41&apiId=249
*/
public static Integer pointWillDueSearch(String platId) {
Map<String, String> params = MapUtil.newHashMap();
params.put("tenant", shuYunConfig.getTenant());
params.put("platId", platId);
params.put("platCode", shuYunConfig.getPlatCode());
params.put("shopId", shuYunConfig.getShopId());
params.put("cardPlanId", shuYunConfig.getCardPlanId());
params.put("timeType", "RELATIVE");
LocalDateTime now = LocalDateTime.now();
String startTime = now.plusHours(1).format(DateTimeFormatter.ofPattern(DateUtils.YYYY_MM_DD_HH_MM_SS));
String endTime = now.with(TemporalAdjusters.lastDayOfYear()).with(LocalTime.MAX).format(DateTimeFormatter.ofPattern(DateUtils.YYYY_MM_DD_HH_MM_SS));
params.put("startTime", startTime);
params.put("endTime", endTime);
try {
R<Integer> r = httpQueryParamsRequest(HttpMethod.GET, params, shuYunConfig.getActionMethod().getPointWillDueSearch(), Integer.class);
if (r.getCode() == ShuYunHttpStatusConstants.HALF_SUCCESS) {
logger.info("查询成功,没有数据");
}
if (r.getCode() != ShuYunHttpStatusConstants.SUCCESS) {
logger.error("请求数云接口-查询会员即将过期积分失败:{}", r.getMsg());
}
return r.getData();
} catch (Exception e) {
logger.error("请求数云接口-查询会员即将过期积分失败:{}", e.getMessage());
throw new ServiceException("请求数云接口-查询会员即将过期积分失败");
}
}
/**
*
* https://open.shuyun.com/#/apidoc?type=23&apiId=86
*/
public static Integer tagCreate(ShuYunTag shuYunTag) {
try {
R<Map> r = httpBodyParamsRequest(HttpMethod.POST, shuYunTag, shuYunConfig.getActionMethod().getTagCreate(), Map.class);
if (r.getCode() == ShuYunHttpStatusConstants.HALF_SUCCESS) {
logger.error("请求数云接口-创建标签失败:{}", r.getMsg());
throw new ServiceException("请求数云接口-创建标签失败");
}
if (r.getData() != null) {
return (Integer) (r.getData().get("tagId"));
}
return null;
} catch (Exception e) {
logger.error("请求数云接口-创建标签失败:{}", e.getMessage());
throw new ServiceException("请求数云接口-创建标签失败");
}
}
/**
*
* https://open.shuyun.com/#/apidoc?type=23&apiId=85
*
* @param type 1()
* @param allValueType true()false()
*/
public static List<ShuYunGroupTag> tagSearch(String type, String allValueType) {
Map<String, String> params = MapUtil.newHashMap();
params.put("type", type);
params.put("allValueType", allValueType);
try {
R r = httpQueryParamsRequest(HttpMethod.GET, params, shuYunConfig.getActionMethod().getTagSearch(), Object.class);
if (r.getCode() == ShuYunHttpStatusConstants.HALF_SUCCESS) {
logger.error("请求数云接口-创建标签失败:{}", r.getMsg());
throw new ServiceException("请求数云接口-创建标签失败");
}
return JSON.parseObject(r.getData().toString(), new TypeReference<List<ShuYunGroupTag>>() {
});
} catch (Exception e) {
logger.error("请求数云接口-创建标签失败:{}", e.getMessage());
throw new ServiceException("请求数云接口-创建标签失败");
}
}
/**
*
* https://open.shuyun.com/#/apidoc?type=23&apiId=153
*/
public static R tagDelete(String tagId) {
Map<String, String> params = MapUtil.newHashMap();
params.put("tagId", tagId);
try {
R r = httpBodyParamsRequest(HttpMethod.DELETE, params,
shuYunConfig.getActionMethod().getTagDelete(), Object.class);
if (r.getCode() == ShuYunHttpStatusConstants.HALF_SUCCESS) {
logger.error("请求数云接口-删除标签失败:{}", r.getMsg());
throw new ServiceException("请求数云接口-删除标签失败");
}
return r;
} catch (Exception e) {
logger.error("请求数云接口-删除标签失败:{}", e.getMessage());
throw new ServiceException("请求数云接口-删除标签失败");
}
}
/**
*
* https://open.shuyun.com/#/apidoc?type=23&apiId=198
*/
public static R tagUpdate(ShuYunTag shuYunTag) {
try {
R r = httpBodyParamsRequest(HttpMethod.PUT, shuYunTag,
shuYunConfig.getActionMethod().getTagUpdate(), Object.class);
if (r.getCode() == ShuYunHttpStatusConstants.HALF_SUCCESS) {
logger.error("请求数云接口-修改标签失败:{}", r.getMsg());
throw new ServiceException("请求数云接口-修改标签失败");
}
return r;
} catch (Exception e) {
logger.error("请求数云接口-修改标签失败:{}", e.getMessage());
throw new ServiceException("请求数云接口-修改标签失败");
}
}
/**
*
*/
public static R markUserTag(ShuYunUserTagReq shuYunUserTagReq) {
try {
R r = httpBodyParamsRequest(HttpMethod.POST, shuYunUserTagReq,
shuYunConfig.getActionMethod().getMarkUserTag(), Object.class);
if (r.getCode() == ShuYunHttpStatusConstants.HALF_SUCCESS) {
logger.error("请求数云接口-给客户打上单个标签失败:{}", r.getMsg());
throw new ServiceException("请求数云接口-给客户打上单个标签失败");
}
return r;
} catch (Exception e) {
logger.error("请求数云接口-给客户打上单个标签失败:{}", e.getMessage());
throw new ServiceException("请求数云接口-给客户打上单个标签失败");
}
}
/**
*
*/
public static List<ShuYunTagResponse> searchUserTag(String tagType, String platCode, String shopId, String platAccount, String allValueType) {
Map<String, Object> params = MapUtil.newHashMap();
// 标签类型0云标签, 1自定义标签
params.put("tagType", tagType);
// 平台代码
params.put("platCode", platCode);
// 店铺ID数云内部店铺ID
params.put("shopId", shopId);
// 平台账号
params.put("platAccount", platAccount);
// 标签显示true(全部标签)false(基本标签)
params.put("allValueType", allValueType);
try {
R r = httpQueryParamsRequest(HttpMethod.GET, params,
shuYunConfig.getActionMethod().getSearchUserTag(), Object.class);
if (r.getCode() == ShuYunHttpStatusConstants.HALF_SUCCESS) {
logger.error("请求数云接口-查询客户已经被打上的标签失败:{}", r.getMsg());
throw new ServiceException("请求数云接口-查询客户已经被打上的标签标签失败");
}
return JSON.parseObject(r.getData().toString(), new TypeReference<List<ShuYunTagResponse>>() {
});
} catch (Exception e) {
logger.error("请求数云接口-查询客户已经被打上的标签失败:{}", e.getMessage());
throw new ServiceException("请求数云接口-查询客户已经被打上的标签失败");
}
}
/**
*
*/
public static R deleteUserTag(String platCode, String shopId, String platAccount, Integer tagId) {
Map<String, Object> params = MapUtil.newHashMap();
// 平台代码
params.put("platCode", platCode);
// 店铺ID数云内部店铺ID
params.put("shopId", shopId);
// 平台账号
params.put("platAccount", platAccount);
// 标签ID
params.put("tagId", tagId);
try {
R r = httpBodyParamsRequest(HttpMethod.DELETE, params,
shuYunConfig.getActionMethod().getDeleteUserTag(), Object.class);
if (r.getCode() == ShuYunHttpStatusConstants.HALF_SUCCESS) {
logger.error("请求数云接口-删除客户已经被打上的标签失败:{}", r.getMsg());
throw new ServiceException("请求数云接口-删除客户已经被打上的标签失败");
}
return r;
} catch (Exception e) {
logger.error("请求数云接口-删除客户已经被打上的标签失败:{}", e.getMessage());
throw new ServiceException("请求数云接口-删除客户已经被打上的标签失败");
}
}
}

@ -0,0 +1,126 @@
package com.flossom.miniProgram.utils.shuyun;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.context.annotation.Configuration;
/**
*
*
* @author flossom
*/
@Configuration
@RefreshScope
@ConfigurationProperties(prefix = "shuyun")
public class ShuYunConfig {
/**
*
*/
private String url;
/**
* appid
*/
private String appid;
/**
* security
*/
private String security;
/**
*
*/
private String authValue;
private String platCode;
private String shopId;
/**
*
*/
private String tenant;
/**
* ID
*/
private String cardPlanId;
private ActionMethod actionMethod;
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getAppid() {
return appid;
}
public void setAppid(String appid) {
this.appid = appid;
}
public String getSecurity() {
return security;
}
public void setSecurity(String security) {
this.security = security;
}
public ActionMethod getActionMethod() {
return actionMethod;
}
public void setActionMethod(ActionMethod actionMethod) {
this.actionMethod = actionMethod;
}
public String getPlatCode() {
return platCode;
}
public void setPlatCode(String platCode) {
this.platCode = platCode;
}
public String getShopId() {
return shopId;
}
public void setShopId(String shopId) {
this.shopId = shopId;
}
public String getAuthValue() {
return authValue;
}
public void setAuthValue(String authValue) {
this.authValue = authValue;
}
public String getTenant() {
return tenant;
}
public void setTenant(String tenant) {
this.tenant = tenant;
}
public String getCardPlanId() {
return cardPlanId;
}
public void setCardPlanId(String cardPlanId) {
this.cardPlanId = cardPlanId;
}
}

@ -108,11 +108,6 @@
<scope>system</scope>
<systemPath>${project.basedir}/src/main/resources/lib/open-platform-sdk-1.0.1.jar</systemPath>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-core</artifactId>
</dependency>
</dependencies>
<build>

@ -0,0 +1,100 @@
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.WxLining;
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.IWxLiningService;
/**
* Controller
*
* @author flossom
* @date 2024-03-26
*/
@RestController
@RequestMapping("/lining")
public class WxLiningController extends BaseController {
@Autowired
private IWxLiningService wxLiningService;
/**
*
*/
@RequiresPermissions("system:lining:list")
@GetMapping("/list")
public TableDataInfo list(WxLining wxLining) {
List<WxLining> list = wxLiningService.selectWxLiningList(wxLining);
return getDataTable(list);
}
/**
*
*/
@RequiresPermissions("system:lining:export")
@Log(title = "膜布", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, WxLining wxLining) {
List<WxLining> list = wxLiningService.selectWxLiningList(wxLining);
ExcelUtil<WxLining> util = new ExcelUtil<WxLining>(WxLining.class);
util.exportExcel(response, list, "膜布数据");
}
/**
*
*/
@RequiresPermissions("system:lining:query")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return success(wxLiningService.selectWxLiningById(id));
}
/**
*
*/
@RequiresPermissions("system:lining:add")
@Log(title = "膜布", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody WxLining wxLining) {
return toAjax(wxLiningService.insertWxLining(wxLining));
}
/**
*
*/
@RequiresPermissions("system:lining:edit")
@Log(title = "膜布", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody WxLining wxLining) {
return toAjax(wxLiningService.updateWxLining(wxLining));
}
/**
*
*/
@RequiresPermissions("system:lining:remove")
@Log(title = "膜布", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(wxLiningService.deleteWxLiningByIds(ids));
}
}

@ -11,7 +11,6 @@ import com.flossom.common.core.domain.req.*;
import com.flossom.common.core.domain.ret.WxUserMemberRet;
import com.flossom.common.core.enums.IntegralChangeTypeEnum;
import com.flossom.common.core.exception.ServiceException;
import com.flossom.common.core.utils.StringUtils;
import com.flossom.common.core.utils.poi.ExcelUtil;
import com.flossom.common.core.web.controller.BaseController;
import com.flossom.common.core.web.domain.AjaxResult;
@ -25,10 +24,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.lang.reflect.Array;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
@ -235,7 +231,9 @@ public class WxUserMemberController extends BaseController {
logger.error("积分操作类型选择有误");
throw new ServiceException("积分操作类型选择有误");
}
wxUserMemberService.batchChangIntegral(wxUserIntegralVm, userIdList);
for (Long userId : userIdList) {
wxUserMemberService.changIntegral(wxUserIntegralVm, userId);
}
return R.ok();
}
@ -250,8 +248,9 @@ public class WxUserMemberController extends BaseController {
}
List<WxUserMember> list = wxUserMemberService.selectWxUserMemberList(operateReq.getWxUserMemberVm());
if (list != null && list.size() > 0) {
List<Long> collect = list.stream().map(wxUserMember -> wxUserMember.getId()).collect(Collectors.toList());
wxUserMemberService.batchChangIntegral(operateReq.getWxUserIntegralVm(), collect);
for (WxUserMember wxUserMember : list) {
wxUserMemberService.changIntegral(operateReq.getWxUserIntegralVm(), wxUserMember.getId());
}
}
return R.ok();
}

@ -0,0 +1,63 @@
package com.flossom.system.service;
import com.flossom.common.core.domain.entity.WxLining;
import java.util.List;
/**
* Service
*
* @author flossom
* @date 2024-03-26
*/
public interface IWxLiningService {
/**
*
*
* @param id
* @return
*/
public WxLining selectWxLiningById(Long id);
/**
*
*
* @param wxLining
* @return
*/
public List<WxLining> selectWxLiningList(WxLining wxLining);
/**
*
*
* @param wxLining
* @return
*/
public int insertWxLining(WxLining wxLining);
/**
*
*
* @param wxLining
* @return
*/
public int updateWxLining(WxLining wxLining);
/**
*
*
* @param ids
* @return
*/
public int deleteWxLiningByIds(Long[] ids);
/**
*
*
* @param id
* @return
*/
public int deleteWxLiningById(Long id);
}

@ -104,4 +104,6 @@ IWxUserMemberService
List<WxUserMemberRet> selectWxUserMemberRetList(WxUserMemberVm wxUserMemberVm);
List<WxUserMemberRet> selectWxUserMemberByIdList(List<Integer> userIdList);
void changIntegral(WxUserIntegralVm wxUserIntegralVm, Long userId);
}

@ -78,6 +78,8 @@ public class WxClockLogServiceImpl implements IWxClockLogService {
}
if (userClockLogReq.getMemberRegisterDateRange() != null && userClockLogReq.getMemberRegisterDateRange().size() > 0) {
wxUserMemberVm.getParams().put("beginTime", userClockLogReq.getMemberRegisterDateRange().get(0));
}
if (userClockLogReq.getMemberRegisterDateRange() != null && userClockLogReq.getMemberRegisterDateRange().size() > 1) {
wxUserMemberVm.getParams().put("endTime", userClockLogReq.getMemberRegisterDateRange().get(1));
}
List<WxUserMember> wxUserMemberList = wxUserMemberMapper.selectWxUserMemberListByVm(wxUserMemberVm);

@ -1,5 +1,6 @@
package com.flossom.system.service.impl;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
@ -45,6 +46,12 @@ public class WxInstrumentServiceImpl implements IWxInstrumentService {
@Autowired
private WxInstrumentTagMapper wxInstrumentTagMapper;
@Autowired
private WxInstrumentLiningMapper wxInstrumentLiningMapper;
@Autowired
private WxLiningMapper wxLiningMapper;
/**
*
*
@ -80,21 +87,53 @@ public class WxInstrumentServiceImpl implements IWxInstrumentService {
selectByInstrumentIdAndClassify(wxInstrument.getId(), InstrumentFileClassifyEnum.INSTRUMENT_INSTRUCTION.getCode());
wxInstrumentSaveReq.setIntroduceList(instructionRelate);
// 获取模式关联
WxInstrumentMode wxInstrumentMode = new WxInstrumentMode();
wxInstrumentMode.setInstrumentId(id);
List<WxInstrumentMode> wxInstrumentModes = wxInstrumentModeMapper.selectWxInstrumentModeList(wxInstrumentMode);
if (wxInstrumentModes != null && wxInstrumentModes.size() > 0) {
wxInstrumentSaveReq.setModeIdsValue(wxInstrumentModes.stream()
.map(WxInstrumentMode::getModeId)
.map(Long::intValue)
.collect(Collectors.toList()));
wxInstrumentSaveReq.setNewModeIdList(wxInstrumentModes.stream()
.filter(im -> im.getIsNew() == 1)
.map(WxInstrumentMode::getModeId)
.map(Long::intValue)
.collect(Collectors.toList())
);
if (!StringUtils.equals(wxInstrument.getModel(), "WE200")) {
// 其他仪器直接获取关联的模式
WxInstrumentMode wxInstrumentMode = new WxInstrumentMode();
wxInstrumentMode.setInstrumentId(id);
List<WxInstrumentMode> wxInstrumentModes = wxInstrumentModeMapper.selectWxInstrumentModeList(wxInstrumentMode);
if (wxInstrumentModes != null && wxInstrumentModes.size() > 0) {
wxInstrumentSaveReq.setModeIdsValue(wxInstrumentModes.stream()
.map(WxInstrumentMode::getModeId)
.map(Long::intValue)
.collect(Collectors.toList()));
wxInstrumentSaveReq.setNewModeIdList(wxInstrumentModes.stream()
.filter(im -> im.getIsNew() == 1)
.map(WxInstrumentMode::getModeId)
.map(Long::intValue)
.collect(Collectors.toList())
);
}
} else {
// we200 获取膜布关联的模式
WxInstrumentLining instrumentLiningQuery = new WxInstrumentLining();
instrumentLiningQuery.setInstrumentId(id);
List<WxInstrumentLining> instrumentLiningList = wxInstrumentLiningMapper.selectWxInstrumentLiningList(instrumentLiningQuery);
if (instrumentLiningList != null) {
List<WxLining> liningList = new ArrayList<>();
for (WxInstrumentLining wxInstrumentLining : instrumentLiningList) {
Long liningId = wxInstrumentLining.getLiningId();
WxLining wxLining = wxLiningMapper.selectWxLiningById(liningId);
WxInstrumentMode instrumentModeQuery = new WxInstrumentMode();
instrumentModeQuery.setInstrumentId(id);
instrumentModeQuery.setLiningId(liningId);
List<WxInstrumentMode> wxInstrumentModeList = wxInstrumentModeMapper.selectWxInstrumentModeList(instrumentModeQuery);
if (wxInstrumentModeList != null && wxInstrumentModeList.size() > 0) {
wxLining.setModeList(wxInstrumentModeList.stream()
.map(WxInstrumentMode::getModeId)
.map(Long::intValue)
.collect(Collectors.toList()));
wxLining.setNewModeIdList(wxInstrumentModeList.stream()
.filter(im -> im.getIsNew() == 1)
.map(WxInstrumentMode::getModeId)
.map(Long::intValue)
.collect(Collectors.toList())
);
liningList.add(wxLining);
}
}
wxInstrumentSaveReq.setWxLiningList(liningList);
}
}
return wxInstrumentSaveReq;
}
@ -222,6 +261,46 @@ public class WxInstrumentServiceImpl implements IWxInstrumentService {
wxInstrumentModeMapper.insertWxInstrumentMode(wxInstrumentMode);
}
}
// 膜布关联的模式
List<WxLining> wxLiningList = wxInstrumentSaveReq.getWxLiningList();
if (wxLiningList != null && wxLiningList.size() > 0) {
wxInstrumentModeMapper.deleteByInstrumentId(wxInstrument.getId());
wxInstrumentLiningMapper.deleteByInstrumentId(wxInstrument.getId());
for (WxLining wxLining : wxLiningList) {
Long liningId = wxLining.getId();
WxInstrumentLining wxInstrumentLining = new WxInstrumentLining();
wxInstrumentLining.setLiningId(liningId);
wxInstrumentLining.setInstrumentId(wxInstrument.getId());
wxInstrumentLining.setStatus(Status.OK.getCode().longValue());
wxInstrumentLining.setCreateBy(SecurityUtils.getUsername());
wxInstrumentLining.setCreateTime(DateUtils.getNowDate());
wxInstrumentLiningMapper.insertWxInstrumentLining(wxInstrumentLining);
List<Integer> modeList = wxLining.getModeList();
if (modeList != null && modeList.size() > 0) {
for (int i = 0; i < modeList.size(); i++) {
WxInstrumentMode wxInstrumentMode = new WxInstrumentMode();
wxInstrumentMode.setInstrumentId(wxInstrument.getId());
wxInstrumentMode.setModeId(modeList.get(i).longValue());
wxInstrumentMode.setModeSort(i);
if (wxLining.getNewModeIdList() != null && wxLining.getNewModeIdList().size() > 0) {
if (wxLining.getNewModeIdList().contains(modeList.get(i))) {
wxInstrumentMode.setIsNew(1);
}
}else {
wxInstrumentMode.setIsNew(0);
}
wxInstrumentMode.setLiningId(liningId);
wxInstrumentMode.setStatus(Status.OK.getCode());
wxInstrumentMode.setCreateBy(SecurityUtils.getUsername());
wxInstrumentMode.setCreateTime(DateUtils.getNowDate());
wxInstrumentModeMapper.insertWxInstrumentMode(wxInstrumentMode);
}
}
}
}
return insertNum;
}
@ -268,7 +347,6 @@ public class WxInstrumentServiceImpl implements IWxInstrumentService {
}
wxInstrument.setUpdateTime(DateUtils.getNowDate());
// 打卡时间处理
// 打卡时间处理
if (wxInstrumentSaveReq.getIsExtraClock() != null && wxInstrumentSaveReq.getIsExtraClock() == 1) {
wxInstrument.setStartTime(wxInstrumentSaveReq.getExtraClockTimeRange().get(0));
@ -329,6 +407,46 @@ public class WxInstrumentServiceImpl implements IWxInstrumentService {
wxInstrumentModeMapper.insertWxInstrumentMode(wxInstrumentMode);
}
}
// 膜布关联的模式
List<WxLining> wxLiningList = wxInstrumentSaveReq.getWxLiningList();
if (wxLiningList != null && wxLiningList.size() > 0) {
wxInstrumentModeMapper.deleteByInstrumentId(wxInstrument.getId());
wxInstrumentLiningMapper.deleteByInstrumentId(wxInstrument.getId());
for (WxLining wxLining : wxLiningList) {
Long liningId = wxLining.getId();
WxInstrumentLining wxInstrumentLining = new WxInstrumentLining();
wxInstrumentLining.setLiningId(liningId);
wxInstrumentLining.setInstrumentId(wxInstrument.getId());
wxInstrumentLining.setStatus(Status.OK.getCode().longValue());
wxInstrumentLining.setCreateBy(SecurityUtils.getUsername());
wxInstrumentLining.setCreateTime(DateUtils.getNowDate());
wxInstrumentLiningMapper.insertWxInstrumentLining(wxInstrumentLining);
List<Integer> modeList = wxLining.getModeList();
if (modeList != null && modeList.size() > 0) {
for (int i = 0; i < modeList.size(); i++) {
WxInstrumentMode wxInstrumentMode = new WxInstrumentMode();
wxInstrumentMode.setInstrumentId(wxInstrument.getId());
wxInstrumentMode.setModeId(modeList.get(i).longValue());
wxInstrumentMode.setModeSort(i);
if (wxLining.getNewModeIdList() != null && wxLining.getNewModeIdList().size() > 0) {
if (wxLining.getNewModeIdList().contains(modeList.get(i))) {
wxInstrumentMode.setIsNew(1);
}
}else {
wxInstrumentMode.setIsNew(0);
}
wxInstrumentMode.setLiningId(liningId);
wxInstrumentMode.setStatus(Status.OK.getCode());
wxInstrumentMode.setCreateBy(SecurityUtils.getUsername());
wxInstrumentMode.setCreateTime(DateUtils.getNowDate());
wxInstrumentModeMapper.insertWxInstrumentMode(wxInstrumentMode);
}
}
}
}
return wxInstrumentMapper.updateWxInstrument(wxInstrument);
}

@ -0,0 +1,91 @@
package com.flossom.system.service.impl;
import java.util.List;
import com.flossom.common.core.domain.entity.WxLining;
import com.flossom.common.core.mapper.WxLiningMapper;
import com.flossom.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.flossom.system.service.IWxLiningService;
/**
* Service
*
* @author flossom
* @date 2024-03-26
*/
@Service
public class WxLiningServiceImpl implements IWxLiningService {
@Autowired
private WxLiningMapper wxLiningMapper;
/**
*
*
* @param id
* @return
*/
@Override
public WxLining selectWxLiningById(Long id) {
return wxLiningMapper.selectWxLiningById(id);
}
/**
*
*
* @param wxLining
* @return
*/
@Override
public List<WxLining> selectWxLiningList(WxLining wxLining) {
return wxLiningMapper.selectWxLiningList(wxLining);
}
/**
*
*
* @param wxLining
* @return
*/
@Override
public int insertWxLining(WxLining wxLining) {
wxLining.setCreateTime(DateUtils.getNowDate());
return wxLiningMapper.insertWxLining(wxLining);
}
/**
*
*
* @param wxLining
* @return
*/
@Override
public int updateWxLining(WxLining wxLining) {
wxLining.setUpdateTime(DateUtils.getNowDate());
return wxLiningMapper.updateWxLining(wxLining);
}
/**
*
*
* @param ids
* @return
*/
@Override
public int deleteWxLiningByIds(Long[] ids) {
return wxLiningMapper.deleteWxLiningByIds(ids);
}
/**
*
*
* @param id
* @return
*/
@Override
public int deleteWxLiningById(Long id) {
return wxLiningMapper.deleteWxLiningById(id);
}
}

@ -1,25 +1,30 @@
package com.flossom.system.service.impl;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.stream.Collectors;
import com.flossom.common.core.constant.IntegralChangTextConstants;
import com.flossom.common.core.domain.entity.*;
import com.flossom.common.core.domain.req.WxUserIntegralVm;
import com.flossom.common.core.domain.req.WxUserMemberReq;
import com.flossom.common.core.domain.req.WxUserMemberVm;
import com.flossom.common.core.domain.ret.WxUserMemberRet;
import com.flossom.common.core.domain.shuyun.ShuYunPointChange;
import com.flossom.common.core.domain.vo.WxUserMemberVo;
import com.flossom.common.core.enums.BindingStatusEnums;
import com.flossom.common.core.enums.IntegralChangeTypeEnum;
import com.flossom.common.core.enums.Status;
import com.flossom.common.core.enums.TagTypeStatusEnum;
import com.flossom.common.core.enums.*;
import com.flossom.common.core.exception.ServiceException;
import com.flossom.common.core.mapper.*;
import com.flossom.common.core.utils.DateUtils;
import com.flossom.common.core.utils.StringUtils;
import com.flossom.common.core.utils.uuid.IdUtils;
import com.flossom.common.security.utils.SecurityUtils;
import com.flossom.system.service.ISysUserService;
import com.flossom.system.utils.shuyun.ShuYunApiUtils;
import com.flossom.system.utils.shuyun.ShuYunConfig;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -73,6 +78,9 @@ public class WxUserMemberServiceImpl implements IWxUserMemberService {
@Autowired
private WxInstrumentMapper wxInstrumentMapper;
@Autowired
private ShuYunConfig shuYunConfig;
/**
*
*
@ -371,7 +379,58 @@ public class WxUserMemberServiceImpl implements IWxUserMemberService {
changeUserMember.setUpdateBy(SecurityUtils.getUsername());
wxUserMemberMapper.updateWxUserMember(changeUserMember);
}
// TODO: 对接数赢:批量积分操作
}
/**
* /
*
* @param wxUserIntegralVm
* @param userId
*/
@Transactional
@Override
public void changIntegral(WxUserIntegralVm wxUserIntegralVm, Long userId) {
// 1、记录积分操作日志
WxUserMember wxUserMember = wxUserMemberMapper.selectWxUserMemberById(userId);
if (wxUserMember != null) {
WxUserIntegralLog wxUserIntegralLog = new WxUserIntegralLog();
wxUserIntegralLog.setUserId(userId);
wxUserIntegralLog.setUserName(wxUserMember.getNickname());
wxUserIntegralLog.setUserPhone(wxUserMember.getMobile());
BeanUtils.copyProperties(wxUserIntegralVm, wxUserIntegralLog);
wxUserIntegralLog.setCreateTime(DateUtils.getNowDate());
wxUserIntegralLog.setCreateBy(SecurityUtils.getUsername());
wxUserIntegralLogMapper.insertWxUserIntegralLog(wxUserIntegralLog);
}
// 2、变更总积分
WxUserMember changeUserMember = new WxUserMember();
if (wxUserIntegralVm.getSource().equals(IntegralChangeTypeEnum.INCREASE.getCode())) {
changeUserMember.setCredit(wxUserMember.getCredit() + wxUserIntegralVm.getFloatScore().intValue());
} else if (wxUserIntegralVm.getSource().equals(IntegralChangeTypeEnum.REDUCE.getCode())) {
if (wxUserMember.getCredit() >= wxUserIntegralVm.getFloatScore().intValue()) {
changeUserMember.setCredit(wxUserMember.getCredit() - wxUserIntegralVm.getFloatScore().intValue());
} else {
changeUserMember.setCredit(0);
}
}
changeUserMember.setId(wxUserMember.getId());
changeUserMember.setUpdateTime(DateUtils.getNowDate());
changeUserMember.setUpdateBy(SecurityUtils.getUsername());
wxUserMemberMapper.updateWxUserMember(changeUserMember);
/**
* TODO
*/
Integer credit;
if (StringUtils.equals(IntegralChangeTypeEnum.INCREASE.getCode(), wxUserIntegralVm.getSource())) {
credit = wxUserIntegralVm.getFloatScore().intValue();
} else {
credit = -wxUserIntegralVm.getFloatScore().intValue();
}
ShuYunPointChange shuYunPointChange = new ShuYunPointChange(wxUserMember.getUnionid(), shuYunConfig.getPlatCode(), shuYunConfig.getShopId(),
IdUtils.generateSequence(), ShuYunPointSourceEnum.OTHER.getSource(), credit,
LocalDateTime.now().format(DateTimeFormatter.ofPattern(DateUtils.YYYY_MM_DD_HH_MM_SS)), IntegralChangTextConstants.DAILY_CLOCK);
ShuYunApiUtils.pointChange(shuYunPointChange);
}
@Override
@ -428,10 +487,10 @@ public class WxUserMemberServiceImpl implements IWxUserMemberService {
wxUserInstrument.setBindingStatus(BindingStatusEnums.BINDED.getCode());
wxUserInstrument.setStatus(Status.OK.getCode().longValue());
List<WxUserInstrument> userInstrumentList = wxUserInstrumentMapper.selectWxUserInstrumentList(wxUserInstrument);
if(userInstrumentList != null && userInstrumentList.size() > 0) {
if (userInstrumentList != null && userInstrumentList.size() > 0) {
userInstrumentList.forEach(ui -> {
WxInstrument wxInstrument = wxInstrumentMapper.selectWxInstrumentById(ui.getInstrumentId());
if(wxInstrument != null) {
if (wxInstrument != null) {
ui.setInstrumentName(wxInstrument.getName());
}
});

@ -8,6 +8,7 @@ import com.flossom.common.core.constant.CacheConstants;
import com.flossom.common.core.domain.R;
import com.flossom.common.core.domain.shuyun.*;
import com.flossom.common.core.exception.ServiceException;
import com.flossom.common.core.utils.DateUtils;
import com.flossom.common.redis.service.RedisService;
import com.flossom.system.utils.HttpClientUtils;
import com.shuyun.open.sdk.bean.HttpMethod;
@ -19,7 +20,10 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.time.temporal.TemporalAdjusters;
import java.util.List;
import java.util.Map;
@ -279,9 +283,21 @@ public class ShuYunApiUtils {
*
* https://open.shuyun.com/#/apidoc?type=41&apiId=249
*/
public static Integer pointWillDueSearch(Map map) {
public static Integer pointWillDueSearch(String platId) {
Map<String, String> params = MapUtil.newHashMap();
params.put("tenant", shuYunConfig.getTenant());
params.put("platId", platId);
params.put("platCode", shuYunConfig.getPlatCode());
params.put("shopId", shuYunConfig.getShopId());
params.put("cardPlanId", shuYunConfig.getCardPlanId());
params.put("timeType", "RELATIVE");
LocalDateTime now = LocalDateTime.now();
String startTime = now.plusHours(1).format(DateTimeFormatter.ofPattern(DateUtils.YYYY_MM_DD_HH_MM_SS));
String endTime = now.with(TemporalAdjusters.lastDayOfYear()).with(LocalTime.MAX).format(DateTimeFormatter.ofPattern(DateUtils.YYYY_MM_DD_HH_MM_SS));
params.put("startTime", startTime);
params.put("endTime", endTime);
try {
R<Integer> r = httpQueryParamsRequest(HttpMethod.GET, map, shuYunConfig.getActionMethod().getPointWillDueSearch(), Integer.class);
R<Integer> r = httpQueryParamsRequest(HttpMethod.GET, params, shuYunConfig.getActionMethod().getPointWillDueSearch(), Integer.class);
if (r.getCode() == ShuYunHttpStatusConstants.HALF_SUCCESS) {
logger.info("查询成功,没有数据");
}

@ -38,6 +38,17 @@ public class ShuYunConfig {
private String shopId;
/**
*
*/
private String tenant;
/**
* ID
*/
private String cardPlanId;
private ActionMethod actionMethod;
@ -96,4 +107,20 @@ public class ShuYunConfig {
public void setAuthValue(String authValue) {
this.authValue = authValue;
}
public String getTenant() {
return tenant;
}
public void setTenant(String tenant) {
this.tenant = tenant;
}
public String getCardPlanId() {
return cardPlanId;
}
public void setCardPlanId(String cardPlanId) {
this.cardPlanId = cardPlanId;
}
}

Binary file not shown.

@ -0,0 +1,44 @@
import request from '@/utils/request'
// 查询膜布列表
export function listLining(query) {
return request({
url: '/system/lining/list',
method: 'get',
params: query
})
}
// 查询膜布详细
export function getLining(id) {
return request({
url: '/system/lining/' + id,
method: 'get'
})
}
// 新增膜布
export function addLining(data) {
return request({
url: '/system/lining',
method: 'post',
data: data
})
}
// 修改膜布
export function updateLining(data) {
return request({
url: '/system/lining',
method: 'put',
data: data
})
}
// 删除膜布
export function delLining(id) {
return request({
url: '/system/lining/' + id,
method: 'delete'
})
}

File diff suppressed because it is too large Load Diff

@ -0,0 +1,293 @@
<template>
<div class="app-container">
<el-tabs v-model="activeName" @tab-click="handleClick" type="border-card">
<el-tab-pane :label="item.code" :name="item.code" v-for="(item, index) of liningList">
<div style="width: 200px; float: left;">
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
<!-- 左侧表单项 -->
<div class="form-top">
<div class="form-top--left">
<el-form-item label="膜布名称" prop="name" style="width: 500px">
<el-input v-model="item.name" placeholder="请输入膜布名称"/>
</el-form-item>
<el-form-item label="购买入口是否显示" label-width="150px" prop="name" style="width: 500px">
<el-switch
v-model="item.isShowBuy == 1"
active-color="#13ce66"
inactive-color="#ff4949">
</el-switch>
</el-form-item>
<el-form-item label="购买商城appid" label-width="150px" prop="skipAppid" style="width: 500px">
<el-input v-model="item.skipAppid" placeholder="请输入购买商城appid"/>
</el-form-item>
<el-form-item label="膜布图标" prop="icon" width="150px">
<template>
<!-- 膜布图标 -->
<el-upload
ref="upload"
:action="uploadUrl"
:headers="headers"
:file-list="item.fileList"
list-type="picture-card"
accept=".jpg,.png"
:limit="1"
:class="{ hide: item.uploadHide }"
:on-remove="iconUploadRemove"
:on-success="iconUploadSuccess"
:on-error="uploadError"
:before-upload="handleBeforeUploadImage"
>
<i slot="default" class="el-icon-plus"></i>
<div slot="file" slot-scope="{ file }">
<img :src="file.url" class="el-upload-list__item-thumbnail" alt=""/>
<span class="el-upload-list__item-actions">
<span @click="iconPicturePreview(file)" class="el-upload-list__item-preview">
<i class="el-icon-zoom-in"></i>
</span>
<span v-if="!disabled" @click="iconUploadRemove(file)" class="el-upload-list__item-delete">
<i class="el-icon-delete"></i>
</span>
</span>
</div>
<div slot="tip" class="el-upload__tip">只能上传jpg/png文件</div>
</el-upload>
<!-- 预览窗口 -->
<el-dialog :visible.sync="dialogVisible" append-to-body>
<img width="100%" :src="dialogImageUrl" alt=""/>
</el-dialog>
</template>
</el-form-item>
</div>
<!-- 右侧表单项 -->
<div class="form-top--right">
<el-form-item label="膜布描述" prop="desc" style="width: 500px">
<el-input v-model="item.desc" placeholder="请输入膜布描述"/>
</el-form-item>
<el-form-item style="height: 36px"/>
<el-form-item label="购买商城PATH" label-width="150px" prop="skipPath" style="width: 500px">
<el-input v-model="item.skipPath" placeholder="请输入购买商城PATH"/>
</el-form-item>
</div>
</div>
</el-form>
<div slot="footer" class="dialog-footer" style="margin-left: 90%;">
<el-button type="primary" @click="submitForm(item)"> </el-button>
</div>
</div>
</el-tab-pane>
</el-tabs>
</div>
</template>
<script>
import {listLining, getLining, delLining, addLining, updateLining} from "@/api/system/lining";
import {getToken} from "@/utils/auth";
export default {
name: "Lining",
data() {
return {
//
activeName: "M01",
/* 文件上传地址 */
uploadUrl: process.env.VUE_APP_BASE_API + '/file/upload',
headers: {
Authorization: 'Bearer ' + getToken(),
},
fileList: [
[], []
],
//
// uploadHide: false,
disabled: false,
dialogImageUrl: '',
dialogVisible: false,
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
liningList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
code: null,
name: null,
desc: null,
isShowBuy: null,
skipAppid: null,
skipPath: null,
icon: null,
status: null,
},
//
form: {},
//
rules: {},
};
},
created() {
this.getList();
},
methods: {
/** 查询膜布列表 */
getList() {
this.loading = true;
listLining().then(response => {
response?.rows?.forEach(item => {
this.liningList.push({
...item,
//
uploadHide: item?.icon != null,
fileList: [{
name: item?.icon,
url: item?.icon
}]
})
})
console.log(this.liningList);
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
code: null,
name: null,
desc: null,
isShowBuy: null,
skipAppid: null,
skipPath: null,
icon: null,
status: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null
};
this.resetForm("form");
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getLining(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改膜布";
});
},
/** 提交按钮 */
submitForm(item) {
this.form = item;
this.form.icon = item.fileList[0].url;
if (this.form.id != null) {
updateLining(this.form).then(response => {
if (response.code == 200) {
this.$modal.msgSuccess("修改成功");
} else {
this.$modal.msgError("修改失败");
}
});
} else {
addLining(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
},
iconUploadRemove(file, fileList) {
this.liningList.forEach(e => {
if (this.activeName === e.code) {
e.fileList = [];
e.uploadHide = false;
}
})
},
iconUploadSuccess(response, file) {
if (response.code == 200) {
this.form.banner = response.data.url
this.liningList.forEach(e => {
if (this.activeName === e.code) {
e.fileList = [{
name: response.data.url,
url: response.data.url
}];
e.uploadHide = true;
}
})
} else {
this.$message.error('图片插入失败')
}
},
handleBeforeUploadImage(file) {
let fileType = ['jpg', 'png', 'JPG', 'PNG']
const fileName = file.name.split('.')
const fileExt = fileName[fileName.length - 1]
const isTypeOk = fileType.indexOf(fileExt) >= 0
if (!isTypeOk) {
this.$modal.msgError(`文件类型只能为jpg格式/png格式`)
return false
}
return true
},
iconPicturePreview(file) {
this.dialogImageUrl = file.url
this.dialogVisible = true
},
/* 文件上传失败 */
uploadError() {
this.$message.error('文件上传失败')
},
handleClick(tab, event) {
console.log(tab, event);
},
}
};
</script>
<style lang="scss" scoped>
.app-container {
.form-top {
display: flex;
justify-content: space-between;
.form-top--right {
flex: 1;
}
}
.form-bottom {
display: flex;
justify-content: flex-end;
}
::v-deep .hide .el-upload--picture-card {
display: none;
}
}
</style>

@ -38,7 +38,11 @@
</template>
</el-table-column>
<el-table-column label="模式名称" align="center" prop="modeName" />
<el-table-column label="模式时长(分钟)" align="center" prop="modeTime" width="180" />
<el-table-column label="模式时长" align="center" prop="modeTime" width="180" >
<template slot-scope="scope">
{{ convertToHMS(scope.row.modeTime) }}
</template>
</el-table-column>
<el-table-column label="模式封面图片" align="center" prop="modeBanner" >
<template slot-scope="scope">
<el-image :src="scope.row.modeBanner" style="width: 60px;height: 80px" :preview-src-list="[scope.row.modeBanner]">
@ -215,7 +219,14 @@
<el-input v-model="form.modeDesc" placeholder="请输入模式描述" maxlength="10"/>
</el-form-item>
<el-form-item label="模式时长" prop="modeTime" v-if="form.instrumentType == 2">
<el-input type="number" v-model="form.modeTime" placeholder="请输入模式时间" maxlength="5" oninput ="value=value.replace(/[^\d]/g,'')"/>
<el-time-picker
v-model="form.modeTimeStr"
value-format="HH:mm:ss"
placeholder="请选择模式时长"
default-value="00:00:00"
@input="pickedTimeComponentChange"
>
</el-time-picker>
</el-form-item>
<el-form-item label="模式封面" prop="modeBanner">
<el-upload
@ -733,7 +744,7 @@ export default {
modeVideo: [
{ required: true, message: "模式视频不能为空", trigger: "blur" }
],
modeTime: [
modeTimeStr: [
{ required: true, message: "模式时长不能为空", trigger: "blur" }
],
stepOneVideo: [
@ -814,7 +825,8 @@ export default {
modeType: null,
modeClass: null,
isCabinMode: null,
modeTime: 0,
modeTime: null,
modeTimeStr: '00:00:00',
preparationVideo: null,
beganVideo: null,
pauseVideo: null,
@ -929,6 +941,12 @@ export default {
url: this.form.stepThreeVideo
})
}
if(this.form.modeTime == null||this.form.modeTime == 0) {
this.form.modeTimeStr = '00:00:00';
this.form.modeTime = 0;
} else {
this.form.modeTimeStr = this.convertToHMS(this.form.modeTime);
}
});
},
handleFileInfo(url) {
@ -1033,13 +1051,6 @@ export default {
this.$message.error("模式功效不能为空");
return;
}
if (this.form.modeTime) {
const regex = /[^0-9]/g;
if (regex.test(this.form.modeTime)) {
this.$modal.msgError("时长仅支持输入正整数");
return;
}
}
// 使
if(this.form.technologyArrayMode!=null &&this.form.technologyArrayMode.length > 0) {
this.form.technologyInfo = this.form.technologyArrayMode.join(",");
@ -1419,7 +1430,35 @@ export default {
this.combineData = this.combineData.filter(x => x.id != row.id);
}
},
}
//
pickedTimeComponentChange() {
console.log(this.form.modeTimeStr)
if(this.form.modeTimeStr == null) {
this.form.modeTimeStr = '00:00:00'
this.form.modeTime = 0;
} else {
this.form.modeTime = this.convertToSeconds(this.form.modeTimeStr);
this.$forceUpdate();
}
},
convertToSeconds(timeStr) {
let hms = timeStr.split(':'); // split it at the colons
return (+hms[0]) * 60 * 60 + (+hms[1]) * 60 + (+hms[2]);
},
convertToHMS(seconds) {
var hours = Math.floor(seconds / 3600);
seconds %= 3600;
var minutes = Math.floor(seconds / 60);
var seconds = seconds % 60;
// Pad the time values if they are less than 10
hours = hours < 10 ? '0' + hours : hours;
minutes = minutes < 10 ? '0' + minutes : minutes;
seconds = seconds < 10 ? '0' + seconds : seconds;
return hours + ':' + minutes + ':' + seconds;
}
}
};
</script>

@ -137,10 +137,10 @@
<el-table-column label="陪伴模式" align="center" prop="accompanyMode"/>
<el-table-column label="创建时间" align="center" min-width="100" prop="createTime"/>
<el-table-column label="护理时长" align="center" prop="nursingTime" width="100"/>
<el-table-column label="位1" align="center" prop="gearPositionOne"/>
<el-table-column label="位2" align="center" prop="gearPositionTwo"/>
<el-table-column label="位3" align="center" prop="gearPositionThree"/>
<el-table-column label="位4" align="center" prop="gearPositionFour"/>
<el-table-column label="位1" align="center" prop="gearPositionOne"/>
<el-table-column label="位2" align="center" prop="gearPositionTwo"/>
<el-table-column label="位3" align="center" prop="gearPositionThree"/>
<el-table-column label="位4" align="center" prop="gearPositionFour"/>
<el-table-column label="能量总值" align="center" prop="energyValue"/>
<el-table-column label="水分数据1" align="center" prop="waterDataOne"/>
<el-table-column label="水分数据2" align="center" prop="waterDataTwo"/>

Loading…
Cancel
Save