Commit 25092129 authored by 王启林's avatar 王启林
parents 9a6f4526 7d006f8d
......@@ -5580,16 +5580,20 @@ orderColList| arrays |否|排序列表字段
**请求样例:**
```
{
"name":"8xbeej",
"deptAbb":"lk7pnx",
"deptNumber":"jjfxah",
"page":1,
"size":10,
"orderColList":["colName":"sort","sortKind":"desc",]
}
{
"siteId":1,
"isWorkGuide":1,
"filter":1,
"page":1,
"source":0,
"size":-1,
"orderColList":[
{
"colName":"sort",
"sortKind":"desc"
}
]
}
```
**响应参数:**
......
......@@ -57,12 +57,6 @@ public class DeptServiceImpl extends AbstractCRUDCacheServiceImpl<DeptDao, DeptE
private MattersDeptService mattersDeptService;
@Autowired
private WindowService windowService;
@Autowired
private BusinessService businessService;
@Autowired
private SiteBusinessService siteBusinessService;
@Autowired
private WindowBusinessService windowBusinessService;
@Override
......@@ -70,22 +64,38 @@ public class DeptServiceImpl extends AbstractCRUDCacheServiceImpl<DeptDao, DeptE
return data.getDeptNumber();
}
/**
* @param entity
* @param context
* @throws AppException
*/
@Override
protected void validData(DeptEntity entity, Context context) throws AppException {
super.validData(entity, context);
//校验部门编码是否重复
protected void saveBefore(DeptEntity entity, Context context) throws AppException {
super.saveBefore(entity, context);
//新增校验部门编码是否重复
DeptEntity extCache = this.getExtCache(entity.getDeptNumber());
if (!ObjectUtils.isEmpty(extCache) && SourceEnum.自定义.getValue() == entity.getSource()) {
if (!ObjectUtils.isEmpty(extCache)) {
throw new AppException("部门编码重复!deptCode:" + extCache.getDeptNumber());
}
}
/**
* @param entity
* @param context
* @throws AppException
*/
@Override
protected void updateBefore(DeptEntity entity, Context context) throws AppException {
super.updateBefore(entity, context);
DeptEntity beforeEntity = this.get(entity.getId(), context);
if(!beforeEntity.getDeptNumber().equals(entity.getDeptNumber())){
DeptEntity extCache = this.getExtCache(entity.getDeptNumber());
if (!ObjectUtils.isEmpty(extCache)) {
throw new AppException("部门编码重复!deptCode:" + extCache.getDeptNumber());
}
}
}
@Override
public void syncDept(String areaCode, Context context) {
List<MattersDeptEntity> deptList = mattersDeptService.find(new MattersDeptQuery());
......@@ -126,7 +136,7 @@ public class DeptServiceImpl extends AbstractCRUDCacheServiceImpl<DeptDao, DeptE
String deptCode = item.getKey();
String deptName = item.getValue();
DeptEntity deptEntity = deptService.getExtCache(deptCode);
// DeptEntity deptEntity = deptService.selectOne(new DeptQuery().siteId(siteId).deptNumber(deptCode), context);
// DeptEntity deptEntity = deptService.selectOne(new DeptQuery().siteId(siteId).deptNumber(deptCode), context);
if (ObjectUtils.isEmpty(deptEntity)) {
deptEntity = new DeptEntity();
deptEntity.initAttrValue();
......
......@@ -9,6 +9,7 @@ import com.mortals.framework.model.OrderCol;
import com.mortals.framework.util.DataUtil;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.common.code.SourceEnum;
import com.mortals.xhx.common.code.YesNoEnum;
import com.mortals.xhx.module.business.model.BusinessEntity;
import com.mortals.xhx.module.dept.model.DeptEntity;
......@@ -53,13 +54,17 @@ public class DeptController extends BaseCRUDJsonBodyMappingController<DeptServic
@Override
protected void doListBefore(DeptEntity query, Map<String, Object> model, Context context) throws AppException {
query.setOrderColList(new ArrayList<OrderCol>() {
{
add(new OrderCol("a.sort", OrderCol.ASCENDING));
add(new OrderCol("a.createTime", OrderCol.ASCENDING));
}
});
if(ObjectUtils.isEmpty(query.getOrderColList())){
query.setOrderColList(new ArrayList<OrderCol>() {
{
add(new OrderCol("a.sort", OrderCol.ASCENDING));
add(new OrderCol("a.createTime", OrderCol.DESCENDING));
}
});
}else {
query.getOrderColList().add(new OrderCol("a.createTime", OrderCol.DESCENDING));
}
if(!ObjectUtils.isEmpty(query.getFilter())&& YesNoEnum.YES.getValue()==query.getFilter()){
//过滤部门事项数据为0的部门
query.setTotalStart(1);
......@@ -163,11 +168,15 @@ public class DeptController extends BaseCRUDJsonBodyMappingController<DeptServic
*/
@Override
protected void saveBefore(DeptEntity entity, Map<String, Object> model, Context context) throws AppException {
DeptEntity deptEntity = this.service.selectOne(new DeptQuery().deptNumber(entity.getDeptNumber()));
if(!ObjectUtils.isEmpty(deptEntity)){
throw new AppException("部门编码已存在!");
// DeptEntity deptEntity = this.service.selectOne(new DeptQuery().deptNumber(entity.getDeptNumber()));
// if(!ObjectUtils.isEmpty(deptEntity)){
// throw new AppException("部门编码已存在!");
// }
if(entity.newEntity()){
entity.setSource(SourceEnum.自定义.getValue());
}
entity.setSource(1);
super.saveBefore(entity, model, context);
}
}
\ No newline at end of file
......@@ -4,12 +4,15 @@ POST {{baseUrl}}/dept/list
Content-Type: application/json
{
"siteId": 1,
"isWorkGuide":1 ,
"filter":1 ,
"page":1,
"source": 0,
"size":-1
"siteId":1,
"page":1,
"size":1,
"orderColList":[
{
"colName":"sort",
"sortKind":"desc"
}
]
}
......
<template>
<div class="myUploadFile">
<a-upload :name="defaultInfo.name" :action="defaultInfo.action" :listType="defaultInfo.listType"
<a-upload
:name="defaultInfo.name"
:action="defaultInfo.action"
:listType="defaultInfo.listType"
:multiple="defaultInfo.multiple"
:showUploadList="defaultInfo.showUploadList"
:defaultFileList="defaultInfo.defaultFileList"
:file-list="defaultInfo.fileList"
:disabled="defaultInfo.disabled"
:directory="defaultInfo.directory"
:data="defaultInfo.objAttach"
:headers="headers"
:remove="uploadRemove"
@change="uploadChange"
@preview="handlePreview"
>
<slot></slot>
</a-upload>
<!-- <a-upload :name="defaultInfo.name" :action="defaultInfo.action" :listType="defaultInfo.listType"
:multiple="defaultInfo.multiple" :showUploadList="defaultInfo.showUploadList"
:defaultFileList="defaultInfo.defaultFileList" :file-list="defaultInfo.fileList" :disabled="defaultInfo.disabled"
:directory="defaultInfo.directory" :data="defaultInfo.objAttach" :headers="headers"
:beforeUpload="beforeImageUpload" :remove="uploadRemove" @change="uploadChange" @preview="handlePreview">
<slot></slot>
</a-upload>
<a-modal :visible="defaultInfo.previewVisible" :footer="null" @cancel="defaultInfo.previewVisible = false">
</a-upload> -->
<a-modal
:visible="defaultInfo.previewVisible"
:footer="null"
@cancel="defaultInfo.previewVisible = false"
>
<img alt="example" style="width: 100%" :src="defaultInfo.previewImage" />
</a-modal>
</div>
......@@ -68,18 +90,15 @@ export default {
"action"
] = `${this.fileCommonupload}?prePath=${this.defaultInfo["prePath"]}`;
} else {
this.defaultInfo[
"action"
] = `${this.fileCommonupload}`;
this.defaultInfo["action"] = `${this.fileCommonupload}`;
}
console.log(this.defaultInfo);
},
deep: true,
immediate: true,
},
},
created() { },
created() {},
methods: {
uploadRemove(file) {
if (file.id != undefined) {
......@@ -88,8 +107,8 @@ export default {
this.defaultInfo.fileList = this.defaultInfo.fileList.filter(
(item) => item.uid != file.uid
);
console.log(this.defaultInfo.fileList.length,"=--------")
if(!this.defaultInfo.fileList.length){
console.log(this.defaultInfo.fileList.length, "=--------");
if (!this.defaultInfo.fileList.length) {
this.$emit("input", ""); //相对地址
}
},
......@@ -117,7 +136,7 @@ export default {
return result;
},
uploadChange({ file, fileList }) {
console.log(fileList)
console.log(fileList);
if (file.status === "error") {
return;
this.$message.error(`${file.name} 上传失败.`);
......@@ -164,4 +183,4 @@ export default {
margin-top: 8px;
color: #666;
}
</style>
\ No newline at end of file
</style>
<template>
<a-modal :width="modalInfo.width" :visible="modalInfo.visible" :title="modalInfo.title"
@cancel="modalInfo.visible = false" centered destroyOnClose>
<a-form-model :label-col="{
span: 5,
}" :wrapper-col="{
span: 19,
}" layout="horizontal" ref="appForm" :model="appForm" :rules="appRules">
<a-modal
:width="modalInfo.width"
:visible="modalInfo.visible"
:title="modalInfo.title"
@cancel="modalInfo.visible = false"
centered
destroyOnClose
>
<a-form-model
:label-col="{
span: 5,
}"
:wrapper-col="{
span: 19,
}"
layout="horizontal"
ref="appForm"
:model="appForm"
:rules="appRules"
>
<a-form-model-item label="应用名称" prop="appName">
<a-input v-model="appForm.appName" placeholder="请输入" allowClear />
</a-form-model-item>
<a-form-model-item label="开发语言" prop="deveLanguage">
<a-select v-model="appForm.deveLanguage" placeholder="请选择" allowClear>
<a-select-option v-for="(item, index) of deveLanguage" :key="index" :value="index">
<a-select
v-model="appForm.deveLanguage"
placeholder="请选择"
allowClear
>
<a-select-option
v-for="(item, index) of deveLanguage"
:key="index"
:value="index"
>
{{ item }}
</a-select-option>
</a-select>
</a-form-model-item>
<a-form-model-item label="版本号" prop="versionNumber">
<a-input v-model="appForm.versionNumber" placeholder="请输入" allowClear />
<a-input
v-model="appForm.versionNumber"
placeholder="请输入"
allowClear
/>
</a-form-model-item>
<a-form-model-item label="版本信息" prop="versionInfo">
<a-textarea v-model="appForm.versionInfo" placeholder="请输入" :rows="4" />
<a-textarea
v-model="appForm.versionInfo"
placeholder="请输入"
:rows="4"
/>
</a-form-model-item>
<a-form-model-item label="应用包" prop="appFileUrl">
<MyUpload v-model="appForm.appFileUrl" :uploadInfo="uploadInfo">
......@@ -32,7 +61,9 @@
</a-form-model-item>
</a-form-model>
<template slot="footer">
<a-button type="primary" class="addclass" @click="Modal_Ok">确定</a-button>
<a-button type="primary" class="addclass" @click="Modal_Ok"
>确定</a-button
>
<a-button @click="resetForm">取消</a-button>
</template>
</a-modal>
......@@ -72,52 +103,69 @@ export default {
},
verload: 300, // 单位 M
limit: 1, //限制文件上传数量
whiteFileList: ["apk"],
whiteFileList: ["apk", "jpg", "jpeg", "png", "gif", "bmp"], //只允许上传apk包
},
appRules: {
appName: [{ required: true, message: "请输入应用名称", trigger: ['blur', 'change'] }],
deveLanguage: [{ required: true, message: "请选择开发语言", trigger: ['blur', 'change'] }],
appName: [
{
required: true,
message: "请输入应用名称",
trigger: ["blur", "change"],
},
],
deveLanguage: [
{
required: true,
message: "请选择开发语言",
trigger: ["blur", "change"],
},
],
},
};
},
mounted() {
},
mounted() {},
methods: {
getInfo(id) {
getAppsInfo({ id: id }).then(res => {
res.data.isEnable = res.data.isEnable == 1
res.data.deveLanguage = this.deveLanguage[res.data.deveLanguage]
this.appForm = res.data
getAppsInfo({ id: id }).then((res) => {
res.data.isEnable = res.data.isEnable == 1;
res.data.deveLanguage = this.deveLanguage[res.data.deveLanguage];
this.appForm = res.data;
if (res.data.appFileUrl) {
this.uploadInfo.fileList = [
{
uid: id,
name: res.data.appFileUrl,
url: res.data.appFileUrl,
}
]
},
];
}
})
});
},
Modal_Ok() {
this.$refs.appForm.validate((valid) => {
if (valid) {
let json = JSON.parse(JSON.stringify(this.appForm))
json.isEnable = json.isEnable ? 1 : 0
saveApps(json).then(res => {
let { code, msg } = res
let json = JSON.parse(JSON.stringify(this.appForm));
json.isEnable = json.isEnable ? 1 : 0;
for (let key in this.deveLanguage) {
this.deveLanguage[key] == json.deveLanguage
? Number((json.deveLanguage = key))
: "";
}
json.productId
? json.productId
: (json.productId = this.$route.query.id);
saveApps(json).then((res) => {
let { code, msg } = res;
if (code == 1) {
this.$message.success('保存成功');
this.$message.success("保存成功");
this.resetForm();
this.modalInfo.visible = false
this.$parent.getList()
this.modalInfo.visible = false;
this.$parent.getList();
} else {
this.$message.error(msg);
}
})
});
} else {
this.$message.error(`请完善表单信息!`);
return false;
......
......@@ -3,6 +3,7 @@ import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.framework.model.PageInfo;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.framework.util.StringUtils;
import com.mortals.xhx.module.product.dao.ProductAppsDao;
import com.mortals.xhx.module.product.model.ProductAppsEntity;
import com.mortals.xhx.module.product.model.ProductEntity;
......@@ -29,6 +30,19 @@ public class ProductAppsServiceImpl extends AbstractCRUDServiceImpl<ProductAppsD
@Autowired
private ProductService productService;
@Override
protected void validData(ProductAppsEntity entity, Context context) throws AppException {
if(entity.getProductId()==null){
throw new AppException("产品id不能为空");
}
if(StringUtils.isEmpty(entity.getAppName())){
throw new AppException("应用名称不能为空");
}
if(entity.getDeveLanguage()==null){
throw new AppException("开发语言不能为空");
}
}
@Override
protected ProductAppsEntity findBefore(ProductAppsEntity params, PageInfo pageInfo, Context context) throws AppException {
if(params.getProductId()==null) {
......
package com.mortals.xhx.module.product.service.impl;
import com.mortals.framework.util.StringUtils;
import org.springframework.stereotype.Service;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.framework.exception.AppException;
......@@ -15,5 +16,14 @@ import com.mortals.xhx.module.product.service.ProductDocumentService;
*/
@Service("productDocumentService")
public class ProductDocumentServiceImpl extends AbstractCRUDServiceImpl<ProductDocumentDao, ProductDocumentEntity, Long> implements ProductDocumentService {
@Override
protected void validData(ProductDocumentEntity entity, Context context) throws AppException {
if(entity.getProductId()==null){
throw new AppException("产品id不能为空");
}
if(StringUtils.isEmpty(entity.getDocName())){
throw new AppException("文档名称不能为空");
}
}
}
\ No newline at end of file
package com.mortals.xhx.module.product.service.impl;
import com.mortals.framework.util.StringUtils;
import org.springframework.stereotype.Service;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.framework.exception.AppException;
......@@ -15,5 +16,17 @@ import com.mortals.xhx.module.product.service.ProductInterfaceService;
*/
@Service("productInterfaceService")
public class ProductInterfaceServiceImpl extends AbstractCRUDServiceImpl<ProductInterfaceDao, ProductInterfaceEntity, Long> implements ProductInterfaceService {
@Override
protected void validData(ProductInterfaceEntity entity, Context context) throws AppException {
if(entity.getProductId()==null){
throw new AppException("产品id不能为空");
}
if(StringUtils.isEmpty(entity.getInterfaceName())){
throw new AppException("接口名称不能为空");
}
if(StringUtils.isEmpty(entity.getVersionNumber())){
throw new AppException("版本号不能为空");
}
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment