浏览代码

十神格局

zhangbin 1 年之前
父节点
当前提交
48ff4c4cbd

+ 97 - 0
xpgx-admin/src/main/java/com/miaxis/app/controller/birthday/BirthdayLogController.java

@@ -0,0 +1,97 @@
+package com.miaxis.app.controller.birthday;
+
+import com.miaxis.birthday.domain.BirthdayLog;
+import com.miaxis.birthday.service.IBirthdayLogService;
+import com.miaxis.common.constant.Constants;
+import com.miaxis.common.core.controller.BaseController;
+import com.miaxis.common.core.domain.Response;
+import com.miaxis.common.core.page.ResponsePageInfo;
+import io.swagger.annotations.*;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * 【查询记录】Controller
+ *
+ * @author miaxis
+ * @date 2023-12-11
+ */
+@RestController
+@RequestMapping(Constants.OPEN_PREFIX + "/birthday/log")
+@Api(tags={"【app-查询记录】"})
+public class BirthdayLogController extends BaseController{
+    @Autowired
+    private IBirthdayLogService birthdayLogService;
+
+    /**
+     * 查询查询记录列表
+     */
+    @GetMapping("/list")
+    @ApiOperation("查询查询记录列表")
+        @ApiImplicitParams({
+            @ApiImplicitParam(name = "pageNum",value = "当前页码" ,dataType = "int", paramType = "query", required = false),
+            @ApiImplicitParam(name = "pageSize",value = "每页数据量" , dataType = "int", paramType = "query", required = false),
+    })
+    public ResponsePageInfo<BirthdayLog> list(@ModelAttribute BirthdayLog birthdayLog){
+        startPage();
+        List<BirthdayLog> list = birthdayLogService.selectBirthdayLogList(birthdayLog);
+        return toResponsePageInfo(list);
+    }
+
+    /**
+     * 获取查询记录详细信息
+     */
+    @GetMapping(value = "/{id}")
+    @ApiOperation("获取查询记录详细信息")
+    public Response<BirthdayLog> getInfo(
+            @ApiParam(name = "id", value = "查询记录参数", required = true)
+            @PathVariable("id") Long id
+    ){
+        return Response.success(birthdayLogService.getById(id));
+    }
+
+    /**
+     * 新增查询记录
+
+    @PostMapping
+    @ApiOperation("新增查询记录")
+    public Response<Integer> add(@RequestBody BirthdayLog birthdayLog){
+        return toResponse(birthdayLogService.save(birthdayLog) ? 1 : 0);
+    }
+     */
+
+    /**
+     * 新增查询记录
+     */
+    @PostMapping
+    @ApiOperation("新增查询记录")
+    public Response<Integer> add(@RequestBody BirthdayLog birthdayLog){
+        return toResponse(birthdayLogService.saveBirthdayLog(birthdayLog) ? 1 : 0);
+    }
+
+
+
+    /**
+     * 修改查询记录
+     */
+    @PutMapping
+    @ApiOperation("修改查询记录")
+    public Response<Integer> edit(@RequestBody BirthdayLog birthdayLog){
+        return toResponse(birthdayLogService.updateById(birthdayLog) ? 1 : 0);
+    }
+
+    /**
+     * 删除查询记录
+     */
+	@DeleteMapping("/{ids}")
+    @ApiOperation("删除查询记录")
+    public  Response<Integer> remove(
+            @ApiParam(name = "ids", value = "查询记录ids参数", required = true)
+            @PathVariable Long[] ids
+    ){
+        return toResponse(birthdayLogService.removeByIds(Arrays.asList(ids)) ? 1 : 0);
+    }
+}

+ 3 - 2
xpgx-admin/src/main/java/com/miaxis/app/controller/gan/GanZhiController.java

@@ -21,6 +21,7 @@ import org.springframework.web.bind.annotation.ModelAttribute;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.util.Date;
 import java.util.List;
 import java.util.Map;
 
@@ -61,8 +62,8 @@ public class GanZhiController extends BaseController {
     @ApiOperation("干支查询8字")
     public Response<GanZhiVo> get8ziByDate(@ModelAttribute GanZhiDto ganZhiDto) {
 
-        String birthDay = ganZhiDto.getBirthDay();
-        Lunar lunar = Lunar.fromDate(DateUtils.parseDate(birthDay));
+        Date birthDay = ganZhiDto.getBirthDay();
+        Lunar lunar = Lunar.fromDate(birthDay);
         System.out.println("农历:" + lunar.getYear() + "年(生肖" + lunar.getYearShengXiao() + ")" + lunar.getMonth() + "月" + lunar.getDay() + "日" + lunar.getTime() + "时");
 
         // 获取干支纪年

+ 2 - 3
xpgx-admin/src/test/java/com/miaxis/test/GanTest.java

@@ -45,10 +45,9 @@ public class GanTest {
 
         // 假设使用 cn.6tail 的 lunar 库来转换日期
         GanZhiDto ganZhiDto = new GanZhiDto();
-        ganZhiDto.setBirthDay("2002-09-08 14:02:00");
+        ganZhiDto.setBirthDay(DateUtils.parseDate("2002-09-08 14:02:00"));
         ganZhiDto.setSex(1);
-        Date d1 = DateUtils.parseDate(ganZhiDto.getBirthDay());
-        Lunar lunar = Lunar.fromDate(d1);
+        Lunar lunar = Lunar.fromDate(ganZhiDto.getBirthDay());
 
         // 获取干支纪年
         ganZhiDto.setYearGan(lunar.getYearGan());

+ 121 - 0
xpgx-service/src/main/java/com/miaxis/birthday/domain/BirthdayLog.java

@@ -0,0 +1,121 @@
+package com.miaxis.birthday.domain;
+
+import java.util.Date;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import com.miaxis.common.annotation.Excel;
+import com.miaxis.common.core.domain.BaseEntity;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.miaxis.common.core.domain.BaseBusinessEntity;
+import lombok.Data;
+/**
+ * 查询记录对象 birthday_log
+ *
+ * @author miaxis
+ * @date 2023-12-11
+ */
+@Data
+@TableName("birthday_log")
+@ApiModel(value = "BirthdayLog", description = "查询记录对象 birthday_log")
+public class BirthdayLog extends BaseBusinessEntity{
+    private static final long serialVersionUID = 1L;
+
+    /** $column.columnComment */
+    @TableId(value = "id")
+    @ApiModelProperty(value = "$column.columnComment")
+    private Long id;
+
+    /** 查询姓名 */
+    @Excel(name = "查询姓名")
+    @TableField("name")
+    @ApiModelProperty(value = "查询姓名")
+    private String name;
+
+    /** 性别 */
+    @Excel(name = "性别")
+    @TableField("sex")
+    @ApiModelProperty(value = "性别")
+    private String sex;
+
+    /** 生日 */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @Excel(name = "生日", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
+    @TableField("birthday")
+    @ApiModelProperty(value = "生日")
+    private Date birthday;
+
+    /** 查询用户ID */
+    @Excel(name = "查询用户ID")
+    @TableField("user_id")
+    @ApiModelProperty(value = "查询用户ID")
+    private Long userId;
+
+    /** 是否付费 0:未付费 1:基础版  2:高级版 */
+    @Excel(name = "是否付费 0:未付费 1:基础版  2:高级版")
+    @TableField("is_pay")
+    @ApiModelProperty(value = "是否付费 0:未付费 1:基础版  2:高级版")
+    private Long isPay;
+
+    public void setId(Long id){
+        this.id = id;
+    }
+
+    public Long getId(){
+        return id;
+    }
+    public void setName(String name){
+        this.name = name;
+    }
+
+    public String getName(){
+        return name;
+    }
+    public void setSex(String sex){
+        this.sex = sex;
+    }
+
+    public String getSex(){
+        return sex;
+    }
+    public void setBirthday(Date birthday){
+        this.birthday = birthday;
+    }
+
+    public Date getBirthday(){
+        return birthday;
+    }
+    public void setUserId(Long userId){
+        this.userId = userId;
+    }
+
+    public Long getUserId(){
+        return userId;
+    }
+    public void setIsPay(Long isPay){
+        this.isPay = isPay;
+    }
+
+    public Long getIsPay(){
+        return isPay;
+    }
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+            .append("id", getId())
+            .append("name", getName())
+            .append("sex", getSex())
+            .append("birthday", getBirthday())
+            .append("userId", getUserId())
+            .append("isPay", getIsPay())
+            .append("createTime", getCreateTime())
+            .append("updateTime", getUpdateTime())
+            .toString();
+    }
+}

+ 25 - 0
xpgx-service/src/main/java/com/miaxis/birthday/mapper/BirthdayLogMapper.java

@@ -0,0 +1,25 @@
+package com.miaxis.birthday.mapper;
+
+import java.util.List;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.miaxis.birthday.domain.BirthdayLog;
+
+/**
+ * 查询记录Mapper接口
+ *
+ * @author miaxis
+ * @date 2023-12-11
+ */
+public interface BirthdayLogMapper extends BaseMapper<BirthdayLog> {
+    /**
+     * 查询查询记录列表
+     *
+     * @param birthdayLog 查询记录
+     * @return 查询记录集合
+     */
+    public List<BirthdayLog> selectBirthdayLogList(BirthdayLog birthdayLog);
+
+
+    public int selectBirthdayLogCount(BirthdayLog birthdayLog);
+
+}

+ 23 - 0
xpgx-service/src/main/java/com/miaxis/birthday/service/IBirthdayLogService.java

@@ -0,0 +1,23 @@
+package com.miaxis.birthday.service;
+
+import java.util.List;
+import com.miaxis.birthday.domain.BirthdayLog;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * 查询记录Service接口
+ *
+ * @author miaxis
+ * @date 2023-12-11
+ */
+public interface IBirthdayLogService extends IService<BirthdayLog>{
+    /**
+     * 查询查询记录列表
+     *
+     * @param birthdayLog 查询记录
+     * @return 查询记录集合
+     */
+    public List<BirthdayLog> selectBirthdayLogList(BirthdayLog birthdayLog);
+
+    boolean saveBirthdayLog(BirthdayLog birthdayLog);
+}

+ 54 - 0
xpgx-service/src/main/java/com/miaxis/birthday/service/impl/BirthdayLogServiceImpl.java

@@ -0,0 +1,54 @@
+package com.miaxis.birthday.service.impl;
+
+import java.util.List;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.miaxis.birthday.mapper.BirthdayLogMapper;
+import com.miaxis.birthday.domain.BirthdayLog;
+import com.miaxis.birthday.service.IBirthdayLogService;
+
+/**
+ * 查询记录Service业务层处理
+ *
+ * @author miaxis
+ * @date 2023-12-11
+ */
+@Service
+@Slf4j
+public class BirthdayLogServiceImpl extends ServiceImpl<BirthdayLogMapper, BirthdayLog> implements IBirthdayLogService {
+    @Autowired
+    private BirthdayLogMapper birthdayLogMapper;
+
+    /**
+     * 查询查询记录列表
+     *
+     * @param birthdayLog 查询记录
+     * @return 查询记录
+     */
+    @Override
+    public List<BirthdayLog> selectBirthdayLogList(BirthdayLog birthdayLog){
+        return birthdayLogMapper.selectBirthdayLogList(birthdayLog);
+    }
+
+
+    /**
+     * 查询记录表
+     *
+     * @param birthdayLog 查询记录
+     * @return 查询记录
+     */
+    @Override
+    public boolean saveBirthdayLog(BirthdayLog birthdayLog){
+        int count = birthdayLogMapper.selectBirthdayLogCount(birthdayLog);
+        if(count>0) {
+            log.info("当前查询8字已存在");
+            return true;
+        } else {
+            return this.save(birthdayLog);
+        }
+
+    }
+
+}

+ 2 - 1
xpgx-service/src/main/java/com/miaxis/gan/dto/GanZhiDto.java

@@ -26,8 +26,9 @@ public class GanZhiDto {
     @ApiModelProperty(value = "性别 1:男  2:女", required = true)
     private Integer sex;
 
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     @ApiModelProperty(value = "出生日期 yyyy-MM-dd HH:mm:ss")
-    private String birthDay;
+    private Date birthDay;
 
     @ApiModelProperty(value = "是否保存 0:不保存 1保存")
     private Integer isSave;

+ 1 - 1
xpgx-service/src/main/java/com/miaxis/gan/service/impl/GanZhiServiceImpl.java

@@ -678,7 +678,7 @@ public class GanZhiServiceImpl extends ServiceImpl<GanZhiMapper, GanZhi> impleme
         }
 
         //判断当天是否是节气,如果在节前前, 月柱修改
-        Date d1 = DateUtils.parseDate(ganZhiDto.getBirthDay());
+        Date d1 = ganZhiDto.getBirthDay();
         Lunar lunar = Lunar.fromDate(d1);
         List<JieQiVo> list = jieQiMapper.selectJiiQiFb(d1);
         if (lunar.getJieQi() != null && !"".equals(lunar.getJieQi())) {

+ 4 - 1
xpgx-service/src/main/java/com/miaxis/gan/vo/GanZhiVo.java

@@ -1,9 +1,11 @@
 package com.miaxis.gan.vo;
 
+import com.fasterxml.jackson.annotation.JsonFormat;
 import com.miaxis.disease.domain.DiseasePart;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
+import java.util.Date;
 import java.util.List;
 import java.util.Map;
 
@@ -25,8 +27,9 @@ public class GanZhiVo {
     @ApiModelProperty(value = "性别")
     private Integer sex;
 
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     @ApiModelProperty(value = "(公历)出生日期 yyyy-MM-dd HH:mm:ss")
-    private String birthDay;
+    private Date birthDay;
 
     @ApiModelProperty(value = "(农历)出生日期")
     private String nongDay;

+ 46 - 0
xpgx-service/src/main/resources/mapper/birthday/BirthdayLogMapper.xml

@@ -0,0 +1,46 @@
+<?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.miaxis.birthday.mapper.BirthdayLogMapper">
+
+    <resultMap type="BirthdayLog" id="BirthdayLogResult">
+        <result property="id" column="id"/>
+        <result property="name" column="name"/>
+        <result property="sex" column="sex"/>
+        <result property="birthday" column="birthday"/>
+        <result property="userId" column="user_id"/>
+        <result property="isPay" column="is_pay"/>
+        <result property="createTime" column="create_time"/>
+        <result property="updateTime" column="update_time"/>
+    </resultMap>
+
+    <sql id="selectBirthdayLogVo">
+        select *
+        from birthday_log
+    </sql>
+
+    <select id="selectBirthdayLogList" parameterType="BirthdayLog" resultMap="BirthdayLogResult">
+        <include refid="selectBirthdayLogVo"/>
+        <where>
+            <if test="name != null  and name != ''">and name like concat('%', #{name}, '%')</if>
+            <if test="sex != null  and sex != ''">and sex = #{sex}</if>
+            <if test="birthday != null ">and birthday = #{birthday}</if>
+            <if test="userId != null ">and user_id = #{userId}</if>
+            <if test="isPay != null ">and is_pay = #{isPay}</if>
+        </where>
+    </select>
+
+
+    <select id="selectBirthdayLogCount" parameterType="BirthdayLog" resultType="int">
+        select count(1) from birthday_log
+        <where>
+            <if test="name != null  and name != ''">and name = #{name}</if>
+            <if test="sex != null  and sex != ''">and sex = #{sex}</if>
+            <if test="birthday != null ">and birthday = #{birthday}</if>
+            <if test="userId != null ">and user_id = #{userId}</if>
+        </where>
+    </select>
+
+
+</mapper>