Merge remote-tracking branch 'origin/feature-20240104' into feature-20240104

master
382696293@qq.com 2 years ago
commit c4f8888843

@ -0,0 +1,143 @@
package com.flossom.common.core.domain.entity;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.flossom.common.core.annotation.Excel;
import com.flossom.common.core.web.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* integral_clock
*
* @author flossom
* @date 2024-01-25
*/
public class IntegralClock extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** $column.columnComment */
private Long id;
/** 日常打卡获得积分 */
@Excel(name = "日常打卡获得积分")
private Long dailyClockCredit;
/** 是否开启额外打卡奖励0关闭、1打开 */
@Excel(name = "是否开启额外打卡奖励", readConverterExp = "0=关闭、1打开")
private Long isExtraClock;
/** 额外打卡奖励积分 */
@Excel(name = "额外打卡奖励积分")
private Long extraClockCredit;
/** 额外打卡时间开始 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm")
@Excel(name = "额外打卡时间开始", width = 30, dateFormat = "yyyy-MM-dd")
private Date startTime;
/** 额外打卡时间结束 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm")
@Excel(name = "额外打卡时间结束", width = 30, dateFormat = "yyyy-MM-dd")
private Date endTime;
/** 状态0正常 1停用 */
@Excel(name = "状态", readConverterExp = "0=正常,1=停用")
private Long status;
private List<String> timeRange = new ArrayList<String>();
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setDailyClockCredit(Long dailyClockCredit)
{
this.dailyClockCredit = dailyClockCredit;
}
public Long getDailyClockCredit()
{
return dailyClockCredit;
}
public void setIsExtraClock(Long isExtraClock)
{
this.isExtraClock = isExtraClock;
}
public Long getIsExtraClock()
{
return isExtraClock;
}
public void setExtraClockCredit(Long extraClockCredit)
{
this.extraClockCredit = extraClockCredit;
}
public Long getExtraClockCredit()
{
return extraClockCredit;
}
public void setStartTime(Date startTime)
{
this.startTime = startTime;
}
public Date getStartTime()
{
return startTime;
}
public void setEndTime(Date endTime)
{
this.endTime = endTime;
}
public Date getEndTime()
{
return endTime;
}
public void setStatus(Long status)
{
this.status = status;
}
public Long getStatus()
{
return status;
}
public List<String> getTimeRange() {
return timeRange;
}
public void setTimeRange(List<String> timeRange) {
this.timeRange = timeRange;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("dailyClockCredit", getDailyClockCredit())
.append("isExtraClock", getIsExtraClock())
.append("extraClockCredit", getExtraClockCredit())
.append("startTime", getStartTime())
.append("endTime", getEndTime())
.append("status", getStatus())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.toString();
}
}

@ -0,0 +1,30 @@
package com.flossom.common.core.enums;
/**
*
*
* @author flossom
*/
public enum ClockStatus
{
OK(1, "正常"), DISABLE(0, "关闭");
private final Integer code;
private final String info;
ClockStatus(Integer code, String info)
{
this.code = code;
this.info = info;
}
public Integer getCode()
{
return code;
}
public String getInfo()
{
return info;
}
}

@ -0,0 +1,62 @@
package com.flossom.common.core.mapper;
import com.flossom.common.core.domain.entity.IntegralClock;
import java.util.List;
/**
* Mapper
*
* @author flossom
* @date 2024-01-25
*/
public interface IntegralClockMapper
{
/**
*
*
* @param id
* @return
*/
public IntegralClock selectIntegralClockById(Long id);
/**
*
*
* @param integralClock
* @return
*/
public List<IntegralClock> selectIntegralClockList(IntegralClock integralClock);
/**
*
*
* @param integralClock
* @return
*/
public int insertIntegralClock(IntegralClock integralClock);
/**
*
*
* @param integralClock
* @return
*/
public int updateIntegralClock(IntegralClock integralClock);
/**
*
*
* @param id
* @return
*/
public int deleteIntegralClockById(Long id);
/**
*
*
* @param ids
* @return
*/
public int deleteIntegralClockByIds(Long[] ids);
}

@ -0,0 +1,101 @@
<?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.IntegralClockMapper">
<resultMap type="IntegralClock" id="IntegralClockResult">
<result property="id" column="id" />
<result property="dailyClockCredit" column="daily_clock_credit" />
<result property="isExtraClock" column="is_extra_clock" />
<result property="extraClockCredit" column="extra_clock_credit" />
<result property="startTime" column="start_time" />
<result property="endTime" column="end_time" />
<result property="status" column="status" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
</resultMap>
<sql id="selectIntegralClockVo">
select id, daily_clock_credit, is_extra_clock, extra_clock_credit, start_time, end_time, status, create_by, create_time, update_by, update_time, remark from integral_clock
</sql>
<select id="selectIntegralClockList" parameterType="IntegralClock" resultMap="IntegralClockResult">
<include refid="selectIntegralClockVo"/>
<where>
<if test="dailyClockCredit != null "> and daily_clock_credit = #{dailyClockCredit}</if>
<if test="isExtraClock != null "> and is_extra_clock = #{isExtraClock}</if>
<if test="extraClockCredit != null "> and extra_clock_credit = #{extraClockCredit}</if>
<if test="startTime != null "> and start_time = #{startTime}</if>
<if test="endTime != null "> and end_time = #{endTime}</if>
<if test="status != null "> and status = #{status}</if>
</where>
</select>
<select id="selectIntegralClockById" parameterType="Long" resultMap="IntegralClockResult">
<include refid="selectIntegralClockVo"/>
where id = #{id}
</select>
<insert id="insertIntegralClock" parameterType="IntegralClock" useGeneratedKeys="true" keyProperty="id">
insert into integral_clock
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="dailyClockCredit != null">daily_clock_credit,</if>
<if test="isExtraClock != null">is_extra_clock,</if>
<if test="extraClockCredit != null">extra_clock_credit,</if>
<if test="startTime != null">start_time,</if>
<if test="endTime != null">end_time,</if>
<if test="status != null">status,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="dailyClockCredit != null">#{dailyClockCredit},</if>
<if test="isExtraClock != null">#{isExtraClock},</if>
<if test="extraClockCredit != null">#{extraClockCredit},</if>
<if test="startTime != null">#{startTime},</if>
<if test="endTime != null">#{endTime},</if>
<if test="status != null">#{status},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
</trim>
</insert>
<update id="updateIntegralClock" parameterType="IntegralClock">
update integral_clock
<trim prefix="SET" suffixOverrides=",">
<if test="dailyClockCredit != null">daily_clock_credit = #{dailyClockCredit},</if>
<if test="isExtraClock != null">is_extra_clock = #{isExtraClock},</if>
<if test="extraClockCredit != null">extra_clock_credit = #{extraClockCredit},</if>
<if test="startTime != null">start_time = #{startTime},</if>
<if test="endTime != null">end_time = #{endTime},</if>
<if test="status != null">status = #{status},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteIntegralClockById" parameterType="Long">
delete from integral_clock where id = #{id}
</delete>
<delete id="deleteIntegralClockByIds" parameterType="String">
delete from integral_clock where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

@ -0,0 +1,117 @@
package com.flossom.system.controller;
import java.text.SimpleDateFormat;
import java.util.List;
import java.io.IOException;
import java.util.Objects;
import javax.servlet.http.HttpServletResponse;
import com.flossom.common.core.domain.entity.IntegralClock;
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.IIntegralClockService;
/**
* Controller
*
* @author flossom
* @date 2024-01-25
*/
@RestController
@RequestMapping("/clockIntegral")
public class IntegralClockController extends BaseController
{
@Autowired
private IIntegralClockService integralClockService;
/**
*
*/
@RequiresPermissions("system:clockIntegral:list")
@GetMapping("/list")
public TableDataInfo list(IntegralClock integralClock)
{
startPage();
List<IntegralClock> list = integralClockService.selectIntegralClockList(integralClock);
SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd HH:mm");
for (IntegralClock clock:list) {
if (Objects.nonNull(clock.getStartTime())) {
clock.getTimeRange().add(sd.format(clock.getStartTime()));
}
if (Objects.nonNull(clock.getEndTime())) {
clock.getTimeRange().add(sd.format(clock.getEndTime()));
}
}
return getDataTable(list);
}
/**
*
*/
@RequiresPermissions("system:clockIntegral:export")
@Log(title = "打卡奖励积分", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, IntegralClock integralClock)
{
List<IntegralClock> list = integralClockService.selectIntegralClockList(integralClock);
ExcelUtil<IntegralClock> util = new ExcelUtil<IntegralClock>(IntegralClock.class);
util.exportExcel(response, list, "打卡奖励积分数据");
}
/**
*
*/
@RequiresPermissions("system:clockIntegral:query")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(integralClockService.selectIntegralClockById(id));
}
/**
*
*/
@RequiresPermissions("system:clockIntegral:add")
@Log(title = "打卡奖励积分", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody IntegralClock integralClock)
{
return toAjax(integralClockService.insertIntegralClock(integralClock));
}
/**
*
*/
@RequiresPermissions("system:clockIntegral:edit")
@Log(title = "打卡奖励积分", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody IntegralClock integralClock)
{
return toAjax(integralClockService.updateIntegralClock(integralClock));
}
/**
*
*/
@RequiresPermissions("system:clockIntegral:remove")
@Log(title = "打卡奖励积分", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(integralClockService.deleteIntegralClockByIds(ids));
}
}

@ -0,0 +1,62 @@
package com.flossom.system.service;
import com.flossom.common.core.domain.entity.IntegralClock;
import java.util.List;
/**
* Service
*
* @author flossom
* @date 2024-01-25
*/
public interface IIntegralClockService
{
/**
*
*
* @param id
* @return
*/
public IntegralClock selectIntegralClockById(Long id);
/**
*
*
* @param integralClock
* @return
*/
public List<IntegralClock> selectIntegralClockList(IntegralClock integralClock);
/**
*
*
* @param integralClock
* @return
*/
public int insertIntegralClock(IntegralClock integralClock);
/**
*
*
* @param integralClock
* @return
*/
public int updateIntegralClock(IntegralClock integralClock);
/**
*
*
* @param ids
* @return
*/
public int deleteIntegralClockByIds(Long[] ids);
/**
*
*
* @param id
* @return
*/
public int deleteIntegralClockById(Long id);
}

@ -0,0 +1,102 @@
package com.flossom.system.service.impl;
import java.util.List;
import com.flossom.common.core.domain.entity.IntegralClock;
import com.flossom.common.core.enums.ClockStatus;
import com.flossom.common.core.mapper.IntegralClockMapper;
import com.flossom.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.flossom.system.service.IIntegralClockService;
/**
* Service
*
* @author flossom
* @date 2024-01-25
*/
@Service
public class IntegralClockServiceImpl implements IIntegralClockService
{
@Autowired
private IntegralClockMapper integralClockMapper;
/**
*
*
* @param id
* @return
*/
@Override
public IntegralClock selectIntegralClockById(Long id)
{
return integralClockMapper.selectIntegralClockById(id);
}
/**
*
*
* @param integralClock
* @return
*/
@Override
public List<IntegralClock> selectIntegralClockList(IntegralClock integralClock)
{
return integralClockMapper.selectIntegralClockList(integralClock);
}
/**
*
*
* @param integralClock
* @return
*/
@Override
public int insertIntegralClock(IntegralClock integralClock)
{
integralClock.setCreateTime(DateUtils.getNowDate());
return integralClockMapper.insertIntegralClock(integralClock);
}
/**
*
*
* @param integralClock
* @return
*/
@Override
public int updateIntegralClock(IntegralClock integralClock)
{
integralClock.setUpdateTime(DateUtils.getNowDate());
// if (ClockStatus.DISABLE.getCode() == integralClock.getIsExtraClock().intValue()) {
// // 当操作关闭的时候,把其他数据关联数据清空
// integralClock.setExtraClockCredit();
// }
return integralClockMapper.updateIntegralClock(integralClock);
}
/**
*
*
* @param ids
* @return
*/
@Override
public int deleteIntegralClockByIds(Long[] ids)
{
return integralClockMapper.deleteIntegralClockByIds(ids);
}
/**
*
*
* @param id
* @return
*/
@Override
public int deleteIntegralClockById(Long id)
{
return integralClockMapper.deleteIntegralClockById(id);
}
}

@ -0,0 +1,44 @@
import request from '@/utils/request'
// 查询打卡奖励积分列表
export function listClock(query) {
return request({
url: '/system/clockIntegral/list',
method: 'get',
params: query
})
}
// 查询打卡奖励积分详细
export function getClock(id) {
return request({
url: '/system/clockIntegral/' + id,
method: 'get'
})
}
// 新增打卡奖励积分
export function addClock(data) {
return request({
url: '/system/clockIntegral',
method: 'post',
data: data
})
}
// 修改打卡奖励积分
export function updateClock(data) {
return request({
url: '/system/clockIntegral',
method: 'put',
data: data
})
}
// 删除打卡奖励积分
export function delClock(id) {
return request({
url: '/system/clockIntegral/' + id,
method: 'delete'
})
}

@ -0,0 +1,218 @@
<template>
<div class="app-container">
<el-form ref="form" :model="form" :rules="rules" label-width="150px">
<el-form-item label="日常打卡奖励:" prop="dailyClockCredit">
<el-input v-model="form.dailyClockCredit" placeholder="请输入日常打卡奖励" style="width: 25%;"/>
</el-form-item>
<el-form-item
label="额外打卡奖励"
prop="isExtraClock"
label-width="120px"
>
<el-switch v-model="form.isExtraClock"> </el-switch>
</el-form-item>
<el-form-item label="额外打卡奖励积分:" prop="extraClockCredit" v-if="form.isExtraClock">
<el-input v-model="form.extraClockCredit" placeholder="请输入额外打卡奖励积分" style="width: 25%;"/>
</el-form-item>
<el-form-item label="额外打卡时间段:" prop="timeRange" label-width="150px" v-if="form.isExtraClock">
<el-date-picker
v-model="form.timeRange"
type="datetimerange"
value-format="yyyy-MM-dd HH:mm"
format="yyyy-MM-dd HH:mm"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
>
</el-date-picker>
</el-form-item>
</el-form>
<div style="margin-left: 70%" >
<el-button type="primary" @click="submitForm"> </el-button>
</div>
</div>
</template>
<script>
import { listClock, getClock, delClock, addClock, updateClock } from "@/api/system/clockIntegral";
export default {
name: "Clock",
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
clockList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
dailyClockCredit: null,
isExtraClock: null,
extraClockCredit: null,
startTime: null,
endTime: null,
status: null,
timeRange:null,
},
//
form: {},
//
rules: {
dailyClockCredit: [
{ required: true, message: "日常打卡奖励不能为空", trigger: "blur" }
],
}
};
},
created() {
this.getList();
},
methods: {
/** 查询打卡奖励积分列表 */
getList() {
this.loading = true;
listClock(this.queryParams).then(response => {
this.form = response.rows.length >0 ? response.rows[0]: {};
if (this.form.isExtraClock == 1) {
this.form.isExtraClock = true;
} else {
this.form.isExtraClock = false;
}
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
dailyClockCredit: null,
isExtraClock: null,
extraClockCredit: null,
startTime: null,
endTime: null,
status: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null,
remark: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加打卡奖励积分";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getClock(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改打卡奖励积分";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
const regex = /[^0-9]/g;
if (regex.test(this.form.dailyClockCredit)) {
this.$modal.msgError("日常打卡奖励积分仅能输入数字");
return;
}
if (this.form.isExtraClock) {
if (regex.test(this.form.extraClockCredit)) {
this.$modal.msgError("额外打卡奖励积分仅能输入数字");
return;
}
if (!this.form.extraClockCredit) {
this.$modal.msgError("积分不能为空");
return;
}
if (this.form.timeRange && this.form.timeRange.length > 0) {
this.form.startTime = this.form.timeRange[0]
this.form.endTime = this.form.timeRange[1]
} else {
this.$modal.msgError("打卡时间不能为空");
return;
}
this.form.isExtraClock = 1;
} else {
this.form.isExtraClock = 0;
}
if (this.form.id != null) {
updateClock(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addClock(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除打卡奖励积分编号为"' + ids + '"的数据项?').then(function() {
return delClock(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('system/clock/export', {
...this.queryParams
}, `clock_${new Date().getTime()}.xlsx`)
}
}
};
</script>

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save