Merge remote-tracking branch 'origin/dev2.0' into dev_price

# Conflicts:
#	src/main/java/com/glxp/api/dao/system/SysMsgTodoMapper.java
#	src/main/java/com/glxp/api/entity/system/SysMsgTodoEntity.java
#	src/main/java/com/glxp/api/service/system/SysMsgTodoService.java
#	src/main/resources/mybatis/mapper/system/SysMsgTodoMapper.xml
test
anthonywj 1 year ago
commit bbcdd1dbd2

@ -0,0 +1,34 @@
package com.glxp.api.config;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.module.SimpleModule;
import com.glxp.api.config.serializer.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
import java.time.LocalDate;
import java.time.LocalDateTime;
@Configuration
public class JacksonConfig {
@Bean
@Primary
// @ConditionalOnMissingBean(ObjectMapper.class)
public ObjectMapper jacksonObjectMapper(Jackson2ObjectMapperBuilder builder) {
ObjectMapper objectMapper = builder.createXmlMapper(false).build();
SimpleModule simpleModule = new SimpleModule();
simpleModule.addSerializer(Long.class, new LongJsonSerializer());
simpleModule.addDeserializer(Long.class, new LongJsonDeserializer());
simpleModule.addSerializer(LocalDate.class, new LocalDateJsonSerializer());
simpleModule.addDeserializer(LocalDate.class, new LocalDateJsonDeserializer());
simpleModule.addSerializer(LocalDateTime.class, new LocalDateTimeJsonSerializer());
simpleModule.addDeserializer(LocalDateTime.class, new LocalDateTimeJsonDeserializer());
objectMapper.registerModule(simpleModule);
return objectMapper;
}
}

@ -15,6 +15,7 @@ import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.core.*;
import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer;
import org.springframework.data.redis.serializer.StringRedisSerializer;
import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
import javax.annotation.Resource;
@ -60,7 +61,7 @@ public class RedisConfig extends CachingConfigurerSupport {
//使用Jackson2JsonRedisSerializer来序列化和反序列化redis的value值默认使用JDK的序列化方式
Jackson2JsonRedisSerializer jacksonSeial = new Jackson2JsonRedisSerializer(Object.class);
ObjectMapper om = new ObjectMapper();
ObjectMapper om = new JacksonConfig().jacksonObjectMapper(new Jackson2ObjectMapperBuilder());
// 指定要序列化的域field,get和set,以及修饰符范围ANY是都有包括private和public
om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY);
// 指定序列化输入的类型类必须是非final修饰的final修饰的类比如String,Integer等会跑出异常

@ -0,0 +1,17 @@
package com.glxp.api.config.serializer;
import cn.hutool.json.JSONNull;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;
import org.springframework.boot.jackson.JsonComponent;
import java.io.IOException;
@JsonComponent
public class JsonNullSerializer extends JsonSerializer<JSONNull> {
@Override
public void serialize(JSONNull jsonNull, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException {
jsonGenerator.writeNull();
}
}

@ -0,0 +1,32 @@
package com.glxp.api.config.serializer;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.LocalDateTimeUtil;
import cn.hutool.core.util.StrUtil;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonDeserializer;
import lombok.extern.slf4j.Slf4j;
import java.io.IOException;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
/**
* Long
*/
@Slf4j
public class LocalDateJsonDeserializer extends JsonDeserializer<LocalDate> {
@Override
public LocalDate deserialize(JsonParser p, DeserializationContext ctxt) throws IOException {
String value = p.getText();
try {
return StrUtil.isEmpty(value) ? null : LocalDateTimeUtil.parseDate(value, DateTimeFormatter.ofPattern(DatePattern.NORM_DATE_PATTERN));
} catch (Exception e) {
log.error("日期格式解析错误", e);
return null;
}
}
}

@ -0,0 +1,23 @@
package com.glxp.api.config.serializer;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.LocalDateTimeUtil;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;
import java.io.IOException;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
/**
* Longjs 14
*/
public class LocalDateJsonSerializer extends JsonSerializer<LocalDate> {
@Override
public void serialize(LocalDate value, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException {
String text = (value == null ? null : LocalDateTimeUtil.format(value, DateTimeFormatter.ofPattern(DatePattern.NORM_DATE_PATTERN)));
jsonGenerator.writeString(text);
}
}

@ -0,0 +1,32 @@
package com.glxp.api.config.serializer;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.LocalDateTimeUtil;
import cn.hutool.core.util.StrUtil;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonDeserializer;
import lombok.extern.slf4j.Slf4j;
import java.io.IOException;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
/**
* Long
*/
@Slf4j
public class LocalDateTimeJsonDeserializer extends JsonDeserializer<LocalDateTime> {
@Override
public LocalDateTime deserialize(JsonParser p, DeserializationContext ctxt) throws IOException {
String value = p.getText();
try {
return StrUtil.isEmpty(value) ? null : LocalDateTimeUtil.parse(value, DateTimeFormatter.ofPattern(DatePattern.NORM_DATETIME_PATTERN));
} catch (Exception e) {
log.error("日期格式解析错误", e);
return null;
}
}
}

@ -0,0 +1,23 @@
package com.glxp.api.config.serializer;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.LocalDateTimeUtil;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;
import java.io.IOException;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
/**
* Longjs 14
*/
public class LocalDateTimeJsonSerializer extends JsonSerializer<LocalDateTime> {
@Override
public void serialize(LocalDateTime value, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException {
String text = (value == null ? null : LocalDateTimeUtil.format(value, DateTimeFormatter.ofPattern(DatePattern.NORM_DATETIME_PATTERN)));
jsonGenerator.writeString(text);
}
}

@ -0,0 +1,23 @@
package com.glxp.api.config.serializer;
import cn.hutool.core.util.StrUtil;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonDeserializer;
import lombok.extern.slf4j.Slf4j;
import java.io.IOException;
/**
* Long
*/
@Slf4j
public class LongJsonDeserializer extends JsonDeserializer<Long> {
@Override
public Long deserialize(JsonParser p, DeserializationContext ctxt) throws IOException {
String value = p.getText();
return StrUtil.isEmpty(value) ? null : Long.parseLong(value);
}
}

@ -0,0 +1,25 @@
package com.glxp.api.config.serializer;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;
import java.io.IOException;
/**
* Longjs 14
*/
public class LongJsonSerializer extends JsonSerializer<Long> {
@Override
public void serialize(Long value, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException {
String text = (value == null ? null : String.valueOf(value));
if (text != null) {
if (text.length() > 14) {
jsonGenerator.writeString(text);
} else {
jsonGenerator.writeNumber(text);
}
}
}
}

@ -0,0 +1,37 @@
package com.glxp.api.controller.system;
import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.pagehelper.PageInfo;
import com.glxp.api.common.res.BaseResponse;
import com.glxp.api.common.util.ResultVOUtils;
import com.glxp.api.entity.system.SysMsgTodoEntity;
import com.glxp.api.req.system.SysMsgTodoQuery;
import com.glxp.api.res.PageSimpleResponse;
import com.glxp.api.service.system.SysMsgTodoService;
import com.glxp.api.vo.system.SysMsgTodoVo;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController
@RequiredArgsConstructor
public class SysMsgTodoController {
private final SysMsgTodoService sysMsgTodoService;
@PostMapping("/spms/sysMsgTodo/page")
public BaseResponse page(@RequestBody SysMsgTodoQuery query) {
List<SysMsgTodoVo> msgTodoVos = sysMsgTodoService.pageOfVo(query);
PageInfo<SysMsgTodoVo> page = new PageInfo<>(msgTodoVos);
PageSimpleResponse<SysMsgTodoVo> simpleResponse = new PageSimpleResponse<>();
simpleResponse.setTotal(page.getTotal());
simpleResponse.setList(BeanUtil.copyToList(msgTodoVos, SysMsgTodoVo.class));
return ResultVOUtils.success(simpleResponse);
}
}

@ -1,9 +1,20 @@
package com.glxp.api.dao.system;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.glxp.api.entity.system.SysMsgTodoEntity;
import org.apache.ibatis.annotations.Mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.glxp.api.req.system.SysMsgTodoQuery;
import com.glxp.api.vo.system.SysMsgTodoVo;
@Mapper
import java.util.List;
/**
* sys_msg_todoMapper
*/
public interface SysMsgTodoMapper extends BaseMapper<SysMsgTodoEntity> {
List<SysMsgTodoVo> pageOfVo(SysMsgTodoQuery query);
}

@ -4,111 +4,96 @@ import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.Date;
import java.time.LocalDateTime;
import lombok.AllArgsConstructor;
import lombok.Builder;
import com.glxp.api.enums.DealStatusEnum;
import com.glxp.api.enums.PushStatusEnum;
import com.glxp.api.enums.TodoMsgTypeEnum;
import lombok.Data;
import lombok.NoArgsConstructor;
@ApiModel(value = "com-glxp-api-entity-system-SysMsgTodo")
/**
*
* @TableName sys_msg_todo
*/
@TableName(value ="sys_msg_todo")
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@TableName(value = "sys_msg_todo")
public class SysMsgTodoEntity implements Serializable {
public class SysMsgTodoEntity {
/**
*
*/
@TableId(value = "id", type = IdType.AUTO)
@ApiModelProperty(value = "")
private Integer id;
private Long id;
/**
*
*/
@TableField(value = "code")
@ApiModelProperty(value = "消息编码")
private String code;
/**
* 1:2:35.;67:8
*/
@TableField(value = "msgType")
@ApiModelProperty(value = "消息类型1:入院物资申请2:单据审核3单据发票确认5.资质审核;6领用单审核7:申购单审核8采购订单审核")
private Byte msgType;
private TodoMsgTypeEnum msgType;
/**
*
*/
@TableField(value = "msgContent")
@ApiModelProperty(value = "消息内容")
private String msgContent;
/**
*
*/
@TableField(value = "dealStatus")
@ApiModelProperty(value = "处理状态")
private Byte dealStatus;
private DealStatusEnum dealStatus;
/**
* 12:3
*/
@TableField(value = "pushStatus")
@ApiModelProperty(value = "推送小程序状态1未推送2:推送成功3推送失败")
private Byte pushStatus;
private PushStatusEnum pushStatus;
/**
*
*/
@TableField(value = "toUrl")
@ApiModelProperty(value = "跳转地址")
private String toUrl;
/**
*
*/
@TableField(value = "createTime")
@ApiModelProperty(value = "创建时间")
private Date createTime;
private LocalDateTime createTime;
/**
*
*/
@TableField(value = "updateUser")
@ApiModelProperty(value = "更新人")
private String updateUser;
/**
*
*/
@TableField(value = "updateTime")
@ApiModelProperty(value = "更新时间")
private Date updateTime;
private LocalDateTime updateTime;
/**
*
*/
@TableField(value = "deptCode")
@ApiModelProperty(value = "所属仓库")
private String deptCode;
/**
*
*/
@TableField(value = "invCode")
@ApiModelProperty(value = "所属仓库")
private String invCode;
/**
*
*/
@TableField(value = "remark")
@ApiModelProperty(value = "备注")
private String remark;
private static final long serialVersionUID = 1L;
}

@ -0,0 +1,20 @@
package com.glxp.api.enums;
import com.baomidou.mybatisplus.annotation.EnumValue;
import lombok.AllArgsConstructor;
import lombok.Getter;
@Getter
@AllArgsConstructor
public enum DealStatusEnum {
NOT_CONFIRMED("not_confirmed", 1, "未处理"),
CONFIRMED("confirmed", 2, "已处理"),
;
final String key;
@EnumValue
final Integer value;
final String desc;
}

@ -0,0 +1,23 @@
package com.glxp.api.enums;
import com.baomidou.mybatisplus.annotation.EnumValue;
import lombok.AllArgsConstructor;
import lombok.Getter;
@Getter
@AllArgsConstructor
public enum PushStatusEnum {
NOT_PUSHED("not_pushed", 1, "未推送"),
PUSH_SUCCESS("push_success", 2, "推送成功"),
PUSH_FAIL("push_fail", 3, "推送失败"),
;
final String key;
@EnumValue
final Integer value;
final String desc;
}

@ -0,0 +1,27 @@
package com.glxp.api.enums;
import com.baomidou.mybatisplus.annotation.EnumValue;
import lombok.AllArgsConstructor;
import lombok.Getter;
@Getter
@AllArgsConstructor
public enum TodoMsgTypeEnum {
PUT_IN_APPLY("put_in_apply", 1, "入院物资申请"),
ORDER_AUDIT("order_audit", 2, "单据审核"),
INVOICE_CONFIRM("invoice_confirm", 3, "单据发票确认"),
CERT_AUDIT("cert_audit", 5, "资质审核"),
USE_AUDIT("use_audit", 6, "领用单审核"),
BUY_APPLY_AUDIT("buy_audit", 7, "申购单审核"),
PROCUREMENT_AUDIT("procurement_audit", 8, "采购单审核"),
;
final String key;
@EnumValue
final Integer value;
final String desc;
}

@ -0,0 +1,19 @@
package com.glxp.api.req.system;
import com.glxp.api.enums.DealStatusEnum;
import com.glxp.api.enums.PushStatusEnum;
import com.glxp.api.enums.TodoMsgTypeEnum;
import com.glxp.api.util.page.ListPageRequest;
import lombok.Data;
@Data
public class SysMsgTodoQuery extends ListPageRequest {
TodoMsgTypeEnum msgType;
PushStatusEnum pushStatus;
DealStatusEnum dealStatus;
String invCode;
String deptCode;
}

@ -1,12 +1,16 @@
package com.glxp.api.service.system;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.glxp.api.dao.system.SysMsgTodoMapper;
import com.glxp.api.entity.system.SysMsgTodoEntity;
import com.baomidou.mybatisplus.extension.service.IService;
import com.glxp.api.req.system.SysMsgTodoQuery;
import com.glxp.api.vo.system.SysMsgTodoVo;
@Service
public class SysMsgTodoService extends ServiceImpl<SysMsgTodoMapper, SysMsgTodoEntity> {
import java.util.List;
/**
* sys_msg_todoService
*/
public interface SysMsgTodoService extends IService<SysMsgTodoEntity> {
List<SysMsgTodoVo> pageOfVo(SysMsgTodoQuery query);
}

@ -0,0 +1,31 @@
package com.glxp.api.service.system.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.glxp.api.entity.system.SysMsgTodoEntity;
import com.glxp.api.req.system.SysMsgTodoQuery;
import com.glxp.api.service.system.SysMsgTodoService;
import com.glxp.api.dao.system.SysMsgTodoMapper;
import com.glxp.api.vo.system.SysMsgTodoVo;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* sys_msg_todoService
*/
@Service
public class SysMsgTodoServiceImpl extends ServiceImpl<SysMsgTodoMapper, SysMsgTodoEntity>
implements SysMsgTodoService {
@Override
public List<SysMsgTodoVo> pageOfVo(SysMsgTodoQuery query) {
PageHelper.startPage(query.getPage(), query.getLimit(), true);
return super.baseMapper.pageOfVo(query);
}
}

@ -0,0 +1,37 @@
package com.glxp.api.vo.system;
import com.glxp.api.entity.system.SysMsgTodoEntity;
import lombok.Data;
@Data
public class SysMsgTodoVo extends SysMsgTodoEntity {
String msgTypeName;
String pushStatusName;
String dealStatusName;
String invName;
String deptName;
public String getMsgTypeName() {
if (super.getMsgType() != null) {
return super.getMsgType().getDesc();
}
return msgTypeName;
}
public String getPushStatusName() {
if (super.getPushStatus() != null) {
return super.getPushStatus().getDesc();
}
return pushStatusName;
}
public String getDealStatusName() {
if (super.getDealStatus() != null) {
return super.getDealStatus().getDesc();
}
return dealStatusName;
}
}

@ -396,6 +396,9 @@
<if test="spUse != null">
AND auth_warehouse.spUse = #{spUse}
</if>
<if test="deptCode != null and deptCode!=''">
AND auth_dept.code = #{deptCode}
</if>
</where>
GROUP BY auth_warehouse.code
</select>

@ -1,26 +1,30 @@
<?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">
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.glxp.api.dao.system.SysMsgTodoMapper">
<resultMap id="BaseResultMap" type="com.glxp.api.entity.system.SysMsgTodoEntity">
<!--@mbg.generated-->
<!--@Table sys_msg_todo-->
<id column="id" jdbcType="INTEGER" property="id"/>
<result column="code" jdbcType="VARCHAR" property="code"/>
<result column="msgType" jdbcType="TINYINT" property="msgType"/>
<result column="msgContent" jdbcType="VARCHAR" property="msgContent"/>
<result column="dealStatus" jdbcType="TINYINT" property="dealStatus"/>
<result column="pushStatus" jdbcType="TINYINT" property="pushStatus"/>
<result column="toUrl" jdbcType="VARCHAR" property="toUrl"/>
<result column="createTime" jdbcType="TIMESTAMP" property="createTime"/>
<result column="updateUser" jdbcType="VARCHAR" property="updateUser"/>
<result column="updateTime" jdbcType="TIMESTAMP" property="updateTime"/>
<result column="deptCode" jdbcType="VARCHAR" property="deptCode"/>
<result column="invCode" jdbcType="VARCHAR" property="invCode"/>
<result column="remark" jdbcType="VARCHAR" property="remark"/>
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, code, msgType, msgContent, dealStatus, pushStatus, toUrl, createTime, updateUser,
updateTime, deptCode, invCode, remark
</sql>
<select id="pageOfVo" resultType="com.glxp.api.vo.system.SysMsgTodoVo">
select *,aw.name invName,ad.name deptName
from sys_msg_todo smt
left join auth_warehouse aw on aw.code = smt.invCode
left join auth_dept ad on ad.code = smt.deptCode
<where>
<if test="msgType!=null">
and smt.msgType = #{msgType}
</if>
<if test="pushStatus!=null">
and smt.pushStatus = #{pushStatus}
</if>
<if test="dealStatus!=null">
and smt.dealStatus = #{dealStatus}
</if>
<if test="invCode!=null and invCode!=''">
and smt.invCode = #{invCode}
</if>
<if test="deptCode!=null and deptCode!=''">
and smt.deptCode = #{deptCode}
</if>
</where>
order by smt.createTime desc
</select>
</mapper>

Loading…
Cancel
Save