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