bug修改、功能调优

This commit is contained in:
Renpc-kilig 2024-05-29 17:41:55 +08:00
parent 7794cc7c33
commit 549674700f
4 changed files with 55 additions and 3 deletions

View File

@ -34,6 +34,8 @@ public class AgreementPortalDTO {
private Integer isDelete; private Integer isDelete;
@ApiModelProperty(name = "agreementType", value = "协议类型") @ApiModelProperty(name = "agreementType", value = "协议类型")
private String agreementType; private String agreementType;
@ApiModelProperty(name = "agreementTypeName", value = "协议类型")
private String agreementTypeName;
@ApiModelProperty(name = "versionNum", value = "版本号") @ApiModelProperty(name = "versionNum", value = "版本号")
private Double versionNum; private Double versionNum;
@ApiModelProperty(name = "sendStatus", value = "发布状态") @ApiModelProperty(name = "sendStatus", value = "发布状态")
@ -134,4 +136,12 @@ public class AgreementPortalDTO {
public void setSendStatus(String sendStatus) { public void setSendStatus(String sendStatus) {
this.sendStatus = sendStatus; this.sendStatus = sendStatus;
} }
public String getAgreementTypeName() {
return agreementTypeName;
}
public void setAgreementTypeName(String agreementTypeName) {
this.agreementTypeName = agreementTypeName;
}
} }

View File

@ -67,6 +67,7 @@ public class AgreementPortalServiceImpl extends DefaultBaseService implements IA
Object o = params.get("sendStatus"); Object o = params.get("sendStatus");
params.remove("sendStatus"); params.remove("sendStatus");
List<AgreementPortalDTO> list = list(params); List<AgreementPortalDTO> list = list(params);
params.put("versionNum", 1);
if(!CollectionUtils.isEmpty(list)) { if(!CollectionUtils.isEmpty(list)) {
Optional<AgreementPortalDTO> max = list.stream() Optional<AgreementPortalDTO> max = list.stream()
.max(Comparator.comparingDouble(AgreementPortalDTO::getVersionNum)); .max(Comparator.comparingDouble(AgreementPortalDTO::getVersionNum));
@ -115,6 +116,18 @@ public class AgreementPortalServiceImpl extends DefaultBaseService implements IA
} else { } else {
setAppUpdateInfo(token, params); setAppUpdateInfo(token, params);
} }
// 查询此类型是否已经有数据
// 如果有则版本号+1
Object o = params.get("sendStatus");
params.remove("sendStatus");
List<AgreementPortalDTO> list = list(params);
params.put("versionNum", 1);
if(!CollectionUtils.isEmpty(list)) {
Optional<AgreementPortalDTO> max = list.stream()
.max(Comparator.comparingDouble(AgreementPortalDTO::getVersionNum));
params.put("versionNum", max.get().getVersionNum() + 1);
}
params.put("sendStatus", o);
agreementDao.update(params); agreementDao.update(params);
} }
@ -156,7 +169,8 @@ public class AgreementPortalServiceImpl extends DefaultBaseService implements IA
@Override @Override
public List<AgreementPortalDTO> list(Map<String, Object> params) { public List<AgreementPortalDTO> list(Map<String, Object> params) {
return agreementDao.list(params); List<AgreementPortalDTO> list = agreementDao.list(params);
return list;
} }
@Override @Override

View File

@ -8,6 +8,7 @@
<result column="content" property="content"/> <result column="content" property="content"/>
<result column="is_open" property="isOpen"/> <result column="is_open" property="isOpen"/>
<result column="agreement_type" property="agreementType"/> <result column="agreement_type" property="agreementType"/>
<result column="agreement_type_name" property="agreementTypeName"/>
<result column="version_num" property="versionNum"/> <result column="version_num" property="versionNum"/>
<result column="send_status" property="sendStatus"/> <result column="send_status" property="sendStatus"/>
<result column="creator" property="creator"/> <result column="creator" property="creator"/>
@ -211,11 +212,13 @@
t1.modifier, t1.modifier,
t1.gmt_modified, t1.gmt_modified,
t1.is_delete, t1.is_delete,
t2.data_name agreement_type_name,
1 1
FROM FROM
data_agreement t1 data_agreement t1 LEFT JOIN data_data t2 ON t1.agreement_type = t2.data_id
WHERE WHERE
t1.is_delete = 0 t1.is_delete = 0
AND t2.is_delete = 0
<if test="sendStatus != null and sendStatus != ''"> <if test="sendStatus != null and sendStatus != ''">
AND t1.send_status = #{sendStatus} AND t1.send_status = #{sendStatus}
</if> </if>
@ -242,6 +245,7 @@
#{agreementIds[${index}]} #{agreementIds[${index}]}
</foreach> </foreach>
</if> </if>
ORDER BY t1.agreement_type, t1.version_num
</select> </select>
<!-- 协议表列表 --> <!-- 协议表列表 -->

View File

@ -90,6 +90,30 @@
return rowData; return rowData;
} }
}, },
{field: 'agreementTypeName', width: 180, title: '协议类型', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
},
{field: 'sendStatus', width: 180, title: '发布状态', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
if(rowData == 'save') {
rowData = '<p style="color: #009688;">保存状态</p>';
}
if(rowData == 'published') {
rowData = '<p style="color: #FF5722;">发布状态</p>';
}
return rowData;
}
},
{field: 'versionNum', width: 180, title: '版本号', align:'center', {field: 'versionNum', width: 180, title: '版本号', align:'center',
templet: function(row) { templet: function(row) {
var rowData = row[this.field]; var rowData = row[this.field];
@ -258,7 +282,7 @@
if(i > 1) { if(i > 1) {
ids += '_'; ids += '_';
} }
ids += item['agreementportalId']; ids += item['agreementId'];
} }
removeData(ids); removeData(ids);
} }