扩展排序字段
This commit is contained in:
parent
0a78f17230
commit
d4f45d5eb3
|
|
@ -0,0 +1,3 @@
|
|||
ALTER TABLE hrsa_push_setting_item ADD sorted_index NUMBER;
|
||||
/
|
||||
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
ALTER TABLE hrsa_push_setting_item ADD sorted_index NUMBER;
|
||||
/
|
||||
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
ALTER TABLE hrsa_push_setting_item ADD sorted_index NUMBER;
|
||||
/
|
||||
|
||||
|
|
@ -0,0 +1 @@
|
|||
ALTER TABLE hrsa_push_setting_item ADD COLUMN sorted_index int(0);
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
ALTER TABLE hrsa_push_setting_item ADD sorted_index NUMBER;
|
||||
/
|
||||
|
|
@ -0,0 +1 @@
|
|||
alter table hrsa_push_setting_item add sorted_index int ;
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
alter table hrsa_push_setting_item add sorted_index int
|
||||
go
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
ALTER TABLE hrsa_push_setting_item ADD sorted_index NUMBER;
|
||||
/
|
||||
|
||||
|
|
@ -59,4 +59,7 @@ public class PushSettingItemDTO {
|
|||
@TableTitle(title = "字段类型", dataIndex = "fieldTypeName", key = "fieldTypeName")
|
||||
private String fieldTypeName;
|
||||
|
||||
@TableTitle(title = "排序", dataIndex = "sortedIndex", key = "sortedIndex")
|
||||
private Integer sortedIndex;
|
||||
|
||||
}
|
||||
|
|
@ -59,6 +59,11 @@ public class PushSettingItemSaveParam {
|
|||
@DataCheck(require = true, message = "字段类型为空")
|
||||
private PushItemFieldEnum fieldType;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private Integer sortedIndex;
|
||||
|
||||
|
||||
//主键id集合
|
||||
private Collection<Long> ids;
|
||||
|
|
|
|||
|
|
@ -62,6 +62,10 @@ public class PushSettingItemPO {
|
|||
@ElogTransform(name = "字段类型")
|
||||
private Integer fieldType;
|
||||
|
||||
|
||||
@ElogTransform(name = "排序")
|
||||
private Integer sortedIndex;
|
||||
|
||||
/**
|
||||
* 租户ID
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -14,13 +14,15 @@ import java.util.Objects;
|
|||
* @version 1.0
|
||||
**/
|
||||
public enum PushRecordStatusEnum implements BaseEnum<Integer> {
|
||||
DATA_PREPARE(0, "数据构建", 87625),
|
||||
DATA_FINISH(1, "构建完毕", 87625),
|
||||
RUN_WAITING(2, "等待执行", 87625),
|
||||
RUN_PROGRESS(3, "执行中", 85393),
|
||||
RUN_COMPLETE(4, "执行完毕", 85393),
|
||||
RUN_SUCCESS(5, "执行成功", 85393),
|
||||
RUN_FAIL(6, "执行失败", 85393);
|
||||
DATA_PREPARE(0, "准备中", 87625),
|
||||
DATA_FINISH(1, "准备完毕", 87625),
|
||||
RUN_PROGRESS(2, "推送中", 85393),
|
||||
RUN_COMPLETE(3, "推送完毕", 85393),
|
||||
RUN_SUCCESS(4, "推送成功", 85393),
|
||||
RUN_FAIL(5, "推送失败", 85393),
|
||||
WITHDRAW(6, "撤回中", 85393),
|
||||
WITHDRAW_SUCCESS(7, "撤回成功", 85393),
|
||||
WITHDRAW_FAIL(8, "撤回失败", 85393);
|
||||
|
||||
private int value;
|
||||
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@
|
|||
<result column="item_name" property="itemName"/>
|
||||
<result column="source" property="source"/>
|
||||
<result column="setting_id" property="settingId"/>
|
||||
<result column="sorted_index" property="sortedIndex"/>
|
||||
<result column="tenant_key" property="tenantKey"/>
|
||||
<result column="update_time" property="updateTime"/>
|
||||
</resultMap>
|
||||
|
|
@ -32,6 +33,7 @@
|
|||
, t.setting_id
|
||||
, t.tenant_key
|
||||
, t.update_time
|
||||
, t.sorted_index
|
||||
</sql>
|
||||
|
||||
<!-- 查询全部 -->
|
||||
|
|
@ -40,6 +42,7 @@
|
|||
<include refid="baseColumns"/>
|
||||
FROM hrsa_push_setting_item t
|
||||
WHERE delete_type = 0
|
||||
ORDER BY sorted_index DESC
|
||||
</select>
|
||||
|
||||
<!-- 根据主键获取单条记录 -->
|
||||
|
|
@ -85,6 +88,9 @@
|
|||
</if>
|
||||
<if test="settingId != null">
|
||||
AND setting_id = #{settingId}
|
||||
</if>
|
||||
<if test="sortedIndex != null">
|
||||
AND sorted_index = #{sortedIndex}
|
||||
</if>
|
||||
<if test="tenantKey != null">
|
||||
AND tenant_key = #{tenantKey}
|
||||
|
|
@ -98,7 +104,7 @@
|
|||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
ORDER BY id DESC
|
||||
ORDER BY sorted_index DESC
|
||||
</select>
|
||||
|
||||
|
||||
|
|
@ -137,6 +143,9 @@
|
|||
<if test="settingId != null">
|
||||
setting_id,
|
||||
</if>
|
||||
<if test="sortedIndex != null">
|
||||
sorted_index,
|
||||
</if>
|
||||
<if test="tenantKey != null">
|
||||
tenant_key,
|
||||
</if>
|
||||
|
|
@ -175,6 +184,9 @@
|
|||
<if test="settingId != null">
|
||||
#{settingId},
|
||||
</if>
|
||||
<if test="sortedIndex != null">
|
||||
#{sortedIndex},
|
||||
</if>
|
||||
<if test="tenantKey != null">
|
||||
#{tenantKey},
|
||||
</if>
|
||||
|
|
@ -197,6 +209,7 @@
|
|||
item_name=#{itemName},
|
||||
source=#{source},
|
||||
setting_id=#{settingId},
|
||||
sorted_index=#{sortedIndex},
|
||||
tenant_key=#{tenantKey},
|
||||
update_time=#{updateTime},
|
||||
</set>
|
||||
|
|
@ -235,6 +248,9 @@
|
|||
<if test="settingId != null">
|
||||
setting_id=#{settingId},
|
||||
</if>
|
||||
<if test="sortedIndex != null">
|
||||
sorted_index=#{sortedIndex},
|
||||
</if>
|
||||
<if test="tenantKey != null">
|
||||
tenant_key=#{tenantKey},
|
||||
</if>
|
||||
|
|
|
|||
|
|
@ -62,6 +62,8 @@ public interface PushService {
|
|||
|
||||
void push(Long id);
|
||||
|
||||
void withdraw(Long id);
|
||||
|
||||
void removeRecords(List<Long> records);
|
||||
|
||||
PageInfo<PushRecordDTO> recordList(RecordListQueryParam param);
|
||||
|
|
|
|||
|
|
@ -191,6 +191,7 @@ public class PushServiceImpl extends Service implements PushService {
|
|||
.fieldName(po.getFieldName())
|
||||
.fieldType(PushItemFieldEnum.parseByValue(po.getFieldType()))
|
||||
.fieldTypeName(PushItemFieldEnum.parseByValue(po.getFieldType()).getDefaultLabel())
|
||||
.sortedIndex(po.getSortedIndex())
|
||||
.build()
|
||||
).collect(Collectors.toList());
|
||||
|
||||
|
|
@ -212,6 +213,7 @@ public class PushServiceImpl extends Service implements PushService {
|
|||
.source(param.getSource())
|
||||
.fieldName(param.getFieldName())
|
||||
.fieldType(param.getFieldType().getValue())
|
||||
.sortedIndex(param.getSortedIndex())
|
||||
.creator((long) user.getUID())
|
||||
.createTime(now)
|
||||
.updateTime(now)
|
||||
|
|
@ -232,6 +234,7 @@ public class PushServiceImpl extends Service implements PushService {
|
|||
po.setSource(param.getSource());
|
||||
po.setFieldName(param.getFieldName());
|
||||
po.setFieldType(param.getFieldType().getValue());
|
||||
po.setSortedIndex(param.getSortedIndex());
|
||||
po.setUpdateTime(now);
|
||||
|
||||
getPushSettingItemMapper().update(po);
|
||||
|
|
@ -406,14 +409,12 @@ public class PushServiceImpl extends Service implements PushService {
|
|||
public void push(Long id) {
|
||||
//待推送
|
||||
PushRecordPO pushRecordPO = getPushRecordMapper().getById(id);
|
||||
pushRecordPO.setStatus(PushRecordStatusEnum.RUN_WAITING.getValue());
|
||||
pushRecordPO.setStartTime(new Date());
|
||||
getPushRecordMapper().updateIgnoreNull(pushRecordPO);
|
||||
|
||||
try {
|
||||
pushRecordPO.setStartTime(new Date());
|
||||
pushRecordPO.setStatus(PushRecordStatusEnum.RUN_PROGRESS.getValue());
|
||||
getPushRecordMapper().updateIgnoreNull(pushRecordPO);
|
||||
|
||||
List<PushRecordDetailPO> pushRecordDetailPOS = getPushRecordDetailMapper().listSome(PushRecordDetailPO.builder().recordId(pushRecordPO.getId()).build());
|
||||
pushRecordDetailPOS.forEach(pushRecordDetailPO -> {
|
||||
|
||||
|
|
@ -452,6 +453,53 @@ public class PushServiceImpl extends Service implements PushService {
|
|||
getPushRecordMapper().updateIgnoreNull(pushRecordPO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void withdraw(Long id) {
|
||||
//待撤回
|
||||
PushRecordPO pushRecordPO = getPushRecordMapper().getById(id);
|
||||
|
||||
try {
|
||||
pushRecordPO.setStartTime(new Date());
|
||||
pushRecordPO.setStatus(PushRecordStatusEnum.WITHDRAW.getValue());
|
||||
getPushRecordMapper().updateIgnoreNull(pushRecordPO);
|
||||
List<PushRecordDetailPO> pushRecordDetailPOS = getPushRecordDetailMapper().listSome(PushRecordDetailPO.builder().recordId(pushRecordPO.getId()).build());
|
||||
pushRecordDetailPOS.forEach(pushRecordDetailPO -> {
|
||||
|
||||
try {
|
||||
String execute = pushRecordDetailPO.getExecute();
|
||||
RecordSet rs = new RecordSet();
|
||||
rs.execute(execute);
|
||||
//建模需要权限重构
|
||||
Integer modeId = pushRecordPO.getModeId();
|
||||
if (modeId != null) {
|
||||
String tableName = pushRecordPO.getTableName();
|
||||
rs.executeQuery("select max(id) from " + tableName);
|
||||
int mainId = 0;
|
||||
if (rs.next()) {
|
||||
mainId = rs.getInt(1);
|
||||
}
|
||||
ModeRightInfo ModeRightInfo = new ModeRightInfo();
|
||||
ModeRightInfo.setNewRight(true);
|
||||
ModeRightInfo.editModeDataShare(1, modeId, mainId);
|
||||
}
|
||||
|
||||
pushRecordDetailPO.setStatus(PushRecordDetailStatusEnum.SUCCESS.getValue());
|
||||
} catch (Exception e) {
|
||||
pushRecordDetailPO.setFailReason(e.getMessage());
|
||||
pushRecordDetailPO.setStatus(PushRecordDetailStatusEnum.FAIL.getValue());
|
||||
}
|
||||
getPushRecordDetailMapper().updateIgnoreNull(pushRecordDetailPO);
|
||||
});
|
||||
|
||||
pushRecordPO.setEndTime(new Date());
|
||||
pushRecordPO.setStatus(PushRecordStatusEnum.WITHDRAW_SUCCESS.getValue());
|
||||
} catch (Exception e) {
|
||||
pushRecordPO.setFailReason(e.getMessage());
|
||||
pushRecordPO.setStatus(PushRecordStatusEnum.WITHDRAW_FAIL.getValue());
|
||||
}
|
||||
getPushRecordMapper().updateIgnoreNull(pushRecordPO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 启动推送
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in New Issue