Browse Source

添加节点类型、标签等

master
陈裕财 4 years ago
parent
commit
ad548744b6
  1. 31
      xm-core/src/main/java/com/xm/core/ctrl/XmProductController.java
  2. 17
      xm-core/src/main/java/com/xm/core/service/XmProductService.java
  3. 4
      xm-core/src/main/java/com/xm/core/service/XmProjectService.java
  4. 2
      xm-core/src/main/resources/mybatis/mapper/xm/core/dao/XmProductMapper.xml
  5. 2
      xm-core/src/main/resources/mybatis/mapper/xm/core/dao/XmProjectMapper.xml

31
xm-core/src/main/java/com/xm/core/ctrl/XmProductController.java

@ -225,22 +225,31 @@ public class XmProductController {
Map<String,Object> m = new HashMap<>();
Tips tips=new Tips("成功新增一条数据");
try{
if(StringUtils.isEmpty(xmProduct.getId())) {
xmProduct.setId(xmProductService.createKey("id"));
User user=LoginUtils.getCurrentUserInfo();
if(StringUtils.isEmpty(xmProduct.getCode())) {
return ResponseHelper.failed("code-0","","产品代号不能为空");
}else{
XmProduct xmProductQuery = new XmProduct(xmProduct.getId());
XmProduct xmProductQuery = new XmProduct();
xmProductQuery.setBranchId(user.getBranchId());
xmProductQuery.setCode(xmProduct.getCode());
if(xmProductService.countByWhere(xmProductQuery)>0){
tips.setFailureMsg("编号重复,请修改编号再提交");
tips.setFailureMsg("产品代号已存在,请修改再提交");
m.put("tips", tips);
return m;
}
}
User user=LoginUtils.getCurrentUserInfo();
if(!StringUtils.hasText(xmProduct.getProductName())){
return ResponseHelper.failed("productName-0","","产品名称不能为空");
}
if(StringUtils.isEmpty(xmProduct.getPmUserid())) {
xmProduct.setPmUserid(user.getUserid());
xmProduct.setPmUsername(user.getUsername());
}
xmProduct.setId(this.xmProductService.createProductId(xmProduct.getCode()));
xmProduct.setCtime(new Date());
xmProduct.setLtime(new Date());
xmProduct.setDel("0");
xmProduct.setLocked("0");
xmProductService.insert(xmProduct);
xmRecordService.addXmProductRecord(xmProduct.getId(),"创建产品","创建产品【"+xmProduct.getId()+"】【"+xmProduct.getProductName()+"】");
@ -294,8 +303,8 @@ public class XmProductController {
XmProduct xmProductDel=new XmProduct();
xmProductDel.setId(xmProductDb.getId());
xmProductDel.setDel("1");
xmProductDb.setLtime(new Date());
xmProductService.updateSomeFieldByPk(xmProductDb);
xmProductDel.setLtime(new Date());
xmProductService.updateSomeFieldByPk(xmProductDel);
xmProductService.clearCache(xmProduct.getId());
xmRecordService.addXmProductRecord(xmProduct.getId(),"删除产品",user.getUsername()+"删除产品【"+xmProductDb.getId()+"】【"+xmProductDb.getProductName()+"】","",JSON.toJSONString(xmProductDb));
@ -330,7 +339,8 @@ public class XmProductController {
if(groupService.checkUserIsProductAdm(xmProductDb,user.getUserid())){
return ResponseHelper.failed("no-qx-0","您无权修改该产品");
}
xmProductService.updateByPk(xmProduct);
xmProduct.setLtime(new Date());
xmProductService.updateSomeFieldByPk(xmProduct);
xmProductService.clearCache(xmProduct.getId());
xmRecordService.addXmProductRecord(xmProduct.getId(),"修改产品","修改产品【"+xmProductDb.getId()+"】【"+xmProductDb.getProductName()+"】",JSON.toJSONString(xmProduct),JSON.toJSONString(xmProductDb));
@ -349,7 +359,7 @@ public class XmProductController {
/***/
/**
@ApiOperation( value = "根据主键列表批量删除产品表信息",notes="batchDelXmProduct,仅需要上传主键字段")
@ApiResponses({
@ApiResponse(code = 200, message = "{tips:{isOk:true/false,msg:'成功/失败原因',tipscode:'失败时错误码'}")
@ -396,7 +406,7 @@ public class XmProductController {
}
}
if(canDelList.size()>0) {
xmProductService.doBatchDelete(canDelList);
//xmProductService.doBatchDelete(canDelList);//不允许批量删除
for (XmProduct xmProduct : canDelList) {
xmProductService.clearCache(xmProduct.getId());
xmRecordService.addXmProductRecord(xmProduct.getId(),"批量删除产品","批量删除产品【"+xmProduct.getId()+"】【"+xmProduct.getProductName()+"】","",JSON.toJSONString(xmProduct));
@ -428,5 +438,6 @@ public class XmProductController {
m.put("tips", tips);
return m;
}
*/
}

17
xm-core/src/main/java/com/xm/core/service/XmProductService.java

@ -89,7 +89,6 @@ public class XmProductService extends BaseService {
@Transactional
public XmProduct copyTo(User user, XmProductCopyVo xmProduct) {
XmProduct pq=new XmProduct();
pq.setId(xmProduct.getId());
XmProduct xmProductDb=this.selectOneObject(pq);
if(xmProductDb==null){
throw new BizException("产品不存在");
@ -109,12 +108,12 @@ public class XmProductService extends BaseService {
String isTpl=xmProduct.getIsTpl();
XmProduct xmProductTo=new XmProduct();
BeanUtils.copyProperties(xmProductDb,xmProductTo);
xmProductTo.setId(this.createKey("id"));
xmProductTo.setProductName(xmProduct.getProductName());
xmProductTo.setCode(xmProduct.getCode());
if(!StringUtils.hasText(xmProduct.getCode())){
xmProductTo.setCode(createProductCode(user.getBranchId()));
}
xmProductTo.setId(this.createProductId(xmProductTo.getCode()));
xmProductTo.setBranchId(user.getBranchId());
xmProductTo.setDeptid(user.getDeptid());
xmProductTo.setDeptName(user.getDeptName());
@ -129,6 +128,9 @@ public class XmProductService extends BaseService {
xmProductTo.setAssUsername(user.getUsername());
xmProductTo.setBizProcInstId(null);
xmProductTo.setBizFlowState("0");
xmProductTo.setLtime(new Date());
xmProductTo.setDel("0");
xmProductTo.setLocked("0");
if(xmProduct.getProductName().equals(xmProductDb.getProductName())){
xmProductTo.setProductName(xmProduct.getProductName()+"(复制)");
}
@ -261,7 +263,18 @@ public class XmProductService extends BaseService {
return code;
}
public String createProductId(String code){
String id=sequenceService.getCommonNo(code+"-{rands:4}");
XmProduct xmProduct=new XmProduct(id);
long idcount=this.countByWhere(xmProduct);
while (idcount>0){
id=sequenceService.getCommonNo(code+"-{rands:4}");
xmProduct=new XmProduct(id);
idcount=this.countByWhere(xmProduct);
}
return id;
}
@Transactional
public void doDeleteByPk(XmProduct xmProduct) {
XmMenu xmMenu=new XmMenu();

4
xm-core/src/main/java/com/xm/core/service/XmProjectService.java

@ -264,6 +264,7 @@ public class XmProjectService extends BaseService {
if(StringUtils.isEmpty(xmProject.getCode())){
xmProject.setCode(this.createKey("code"));
}
xmProject.setLtime(new Date());
this.updateByPk(xmProject);
xmRecordService.addXmProjectRecord(xmProject.getId(), "项目-修改项目基础信息", "更新项目"+xmProject.getName(),JSONObject.toJSONString(xmProject),JSONObject.toJSONString(oldValue));
@ -309,6 +310,9 @@ public class XmProjectService extends BaseService {
if(!StringUtils.hasText(xmProjectVo.getIsTpl())){
xmProjectVo.setIsTpl("0");
}
xmProjectVo.setLocked("0");
xmProjectVo.setDel("0");
xmProjectVo.setLtime(new Date());
XmProject projectDb=new XmProject();
BeanUtils.copyProperties(xmProjectVo,projectDb);
this.insert(projectDb);

2
xm-core/src/main/resources/mybatis/mapper/xm/core/dao/XmProductMapper.xml

@ -25,7 +25,7 @@
</if>
<if test="ctimeStart!=null and ctimeEnd!=null ">and ctime between #{ctimeStart} and #{ctimeEnd}</if>
<if test="del==null or del==''">
and res.del!='1'
and res.del!="1"
</if>
</sql>

2
xm-core/src/main/resources/mybatis/mapper/xm/core/dao/XmProjectMapper.xml

@ -65,7 +65,7 @@
and (res.branch_id in( #{platformBranchId},#{myBranchId}) and res.is_tpl='1')
</if>
<if test="del==null or del==''">
and res.del!='1'
and res.del!="1"
</if>
</sql>
<insert id="insertProcessApprova"

Loading…
Cancel
Save