/**
  * @Title: addParClientLevel @Description: TODO(新增客户等级)
  *
  * @param @param parClientLevel
  * @param @return 设定文件
  * @return Object 返回类型
  * @throws
  */
 @Transactional(readOnly = false)
 @MethodLog(opera = "ClientLevelList_add")
 public Object addParClientLevel(ParClientLevel parClientLevel) {
   Subject pricipalSubject = SecurityUtils.getSubject();
   User pricipalUser = (User) pricipalSubject.getPrincipal();
   JqReturnJson returnResult = new JqReturnJson(); // 构建返回结果,默认结果为false
   ParClientLevelExample parClientLevelExample = new ParClientLevelExample();
   int count = 0;
   // 防止客户等级名称重复
   parClientLevelExample
       .createCriteria()
       .andClientLevelNameEqualTo(parClientLevel.getClientLevelName());
   count = parClientLevelMapper.countByExample(parClientLevelExample);
   if (count > 0) {
     returnResult.setMsg("客户等级名称重复");
     returnResult.setSuccess(false);
     return returnResult;
   }
   parClientLevel.setClientLevelId(RandomGUID.getRandomGUID());
   parClientLevel.setCreater(pricipalUser.getUserCnName());
   parClientLevel.setCreateTime(new Date());
   parClientLevel.setUpdater(pricipalUser.getUserCnName());
   parClientLevel.setUpdateTime(new Date());
   count = parClientLevelMapper.insert(parClientLevel);
   if (count == 1) {
     returnResult.setSuccess(true);
     returnResult.setMsg("[" + parClientLevel.getClientLevelName() + "] 客户等级信息已保存");
   } else {
     returnResult.setMsg("发生未知错误,客户等级信息保存失败");
   }
   return returnResult;
 }
 /**
  * @Title: addSuppliers @Description: TODO(新增供应商来源信息)
  *
  * @param @param Suppliers
  * @param @return 设定文件
  * @return Object 返回类型
  * @throws
  */
 @Transactional(readOnly = false)
 @MethodLog(opera = "SuppliersSourceList_add")
 public Object addSuppliersSource(ParSuppliersSource suppliersSource) {
   Subject pricipalSubject = SecurityUtils.getSubject();
   User pricipalUser = (User) pricipalSubject.getPrincipal();
   JqReturnJson returnResult = new JqReturnJson(); // 构建返回结果,默认结果为false
   ParSuppliersSourceExample suppliersExample = new ParSuppliersSourceExample();
   int count = 0;
   // 防止名称重复
   suppliersExample.createCriteria().andSourceNameEqualTo(suppliersSource.getSourceName());
   count = suppliersSourceMapper.countByExample(suppliersExample);
   if (count > 0) {
     returnResult.setMsg("供应商来源信息名称重复");
     returnResult.setSuccess(false);
     return returnResult;
   }
   suppliersSource.setSourceId(RandomGUID.getRandomGUID());
   suppliersSource.setCreater(pricipalUser.getUserCnName());
   suppliersSource.setCreateTime(new Date());
   suppliersSource.setUpdater(pricipalUser.getUserCnName());
   suppliersSource.setUpdateTime(new Date());
   count = suppliersSourceMapper.insert(suppliersSource);
   if (count == 1) {
     returnResult.setSuccess(true);
     returnResult.setMsg("信息已保存");
   } else {
     returnResult.setMsg("发生未知错误,信息保存失败");
   }
   return returnResult;
 }
Exemplo n.º 3
0
 /**
  * @Title: addGoodsList @Description: TODO(新增货物档案信息)
  *
  * @param @param suppliersGrade
  * @param @return 设定文件
  * @return Object 返回类型
  * @throws
  */
 @Transactional(readOnly = false)
 @MethodLog(opera = "GoodsList_add")
 public Object addGoodsList(GoodsList goodsList) {
   Subject pricipalSubject = SecurityUtils.getSubject();
   User pricipalUser = (User) pricipalSubject.getPrincipal();
   JqReturnJson returnResult = new JqReturnJson(); // 构建返回结果,默认结果为false
   GoodsListExample goodsListExample = new GoodsListExample();
   int count = 0;
   // 防止货物档案名称重复
   goodsListExample.createCriteria().andGoodsNameEqualTo(goodsList.getGoodsName());
   count = goodsListMapper.countByExample(goodsListExample);
   if (count > 0) {
     returnResult.setMsg("货物档案信息重复,请重新填写!");
     returnResult.setSuccess(false);
     return returnResult;
   }
   // 随机号生成
   SimpleDateFormat SF = new SimpleDateFormat("yyyy-MM-DD-HHmmss");
   goodsList.setGoodsId(RandomGUID.getRandomGUID());
   goodsList.setGoodsCode("GD_" + SF.format(new Date()));
   goodsList.setSpecification("SP_" + SF.format(new Date()));
   goodsList.setAuditor("超级管理员");
   goodsList.setAuditState("pass");
   goodsList.setAuditTime(new Date());
   goodsList.setEnabled("enable");
   goodsList.setGoodsTypeId(goodsList.getGoodsSortId());
   goodsList.setCreater(pricipalUser.getUserCnName());
   goodsList.setCreateTime(new Date());
   goodsList.setUpdater(pricipalUser.getUserCnName());
   goodsList.setUpdateTime(new Date());
   count = goodsListMapper.insert(goodsList);
   if (count == 1) {
     returnResult.setSuccess(true);
     returnResult.setMsg("【" + goodsList.getGoodsName() + "】 货物档案信息信息已保存");
   } else {
     returnResult.setMsg("发生未知错误,货物档案信息保存失败");
   }
   return returnResult;
 }
Exemplo n.º 4
0
 /**
  * @Title: editGoodsList @Description: TODO(修改货物档案信息)
  *
  * @param @param suppliersIndustry
  * @param @return 设定文件
  * @return Object 返回类型
  * @throws
  */
 @Transactional(readOnly = false)
 @MethodLog(opera = "GoodsList_edit")
 public Object editGoodsList(GoodsList goodsList) {
   Subject pricipalSubject = SecurityUtils.getSubject();
   User pricipalUser = (User) pricipalSubject.getPrincipal();
   JqReturnJson returnResult = new JqReturnJson(); // 构建返回结果,默认结果为false
   int count = 0;
   goodsList.setUpdater(pricipalUser.getUserCnName());
   goodsList.setUpdateTime(new Date());
   count = goodsListMapper.updateByPrimaryKeySelective(goodsList);
   if (count == 1) {
     returnResult.setSuccess(true);
     returnResult.setMsg("【" + goodsList.getGoodsName() + "】货物档案信息已保存");
   } else {
     returnResult.setMsg("发生未知错误,货物档案信息保存失败");
   }
   return returnResult;
 }