|
@@ -93,6 +93,44 @@ public class LantoneProductFacade extends LantoneProductServiceImpl {
|
|
|
BeanUtil.copyProperties(updateProductVO, lantoneProduct);
|
|
|
lantoneProduct.setModifier(UserUtils.getCurrentPrincipleID());
|
|
|
lantoneProduct.setGmtModified(DateUtil.now());
|
|
|
+ if(updateProductVO.getServiceStatus()==StatusEnum.Disable.getKey()){
|
|
|
+ Page page =new Page();
|
|
|
+ OpenedProductsIndex openedProductsIndex =new OpenedProductsIndex();
|
|
|
+ openedProductsIndex.setProductId(updateProductVO.getId());
|
|
|
+ openedProductsIndex.setServiceStatus(StatusEnum.Enable.getKey());
|
|
|
+ if(openedProductsFacade.getByProductId(page,openedProductsIndex).getRecords().size()>0){
|
|
|
+ throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
|
|
|
+ "用户正在使用中,停用失败");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!updateById(lantoneProduct)) {
|
|
|
+ throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
|
|
|
+ "产品修改失败");
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 朗通产品线管理停用启用产品
|
|
|
+ *
|
|
|
+ * @param updateProductVO 所需参数(产品id,停用状态)
|
|
|
+ * @return Boolean true
|
|
|
+ */
|
|
|
+ public Boolean stopProduct(UpdateProductVO updateProductVO) {
|
|
|
+ LantoneProduct lantoneProduct = this.getById(updateProductVO.getId());
|
|
|
+ BeanUtil.copyProperties(updateProductVO, lantoneProduct);
|
|
|
+ lantoneProduct.setModifier(UserUtils.getCurrentPrincipleID());
|
|
|
+ lantoneProduct.setGmtModified(DateUtil.now());
|
|
|
+ if(updateProductVO.getServiceStatus()==StatusEnum.Disable.getKey()){
|
|
|
+ Page page =new Page();
|
|
|
+ OpenedProductsIndex openedProductsIndex =new OpenedProductsIndex();
|
|
|
+ openedProductsIndex.setProductId(updateProductVO.getId());
|
|
|
+ openedProductsIndex.setServiceStatus(StatusEnum.Enable.getKey());
|
|
|
+ if(openedProductsFacade.getByProductId(page,openedProductsIndex).getRecords().size()>0){
|
|
|
+ throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
|
|
|
+ "用户正在使用中,停用失败");
|
|
|
+ }
|
|
|
+ }
|
|
|
if (!updateById(lantoneProduct)) {
|
|
|
throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
|
|
|
"产品修改失败");
|
|
@@ -108,6 +146,10 @@ public class LantoneProductFacade extends LantoneProductServiceImpl {
|
|
|
*/
|
|
|
public Boolean deleteProduct(UpdateProductVO updateProductVO) {
|
|
|
LantoneProduct lantoneProduct = getById(updateProductVO.getId());
|
|
|
+ if(lantoneProduct.getServiceStatus()==StatusEnum.Enable.getKey()){
|
|
|
+ throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
|
|
|
+ "当前产品正在使用中不可删除");
|
|
|
+ }
|
|
|
OpenedProducts openedProducts = new OpenedProducts();
|
|
|
openedProducts.setProductId(updateProductVO.getId());
|
|
|
openedProducts.setServiceStatus(StatusEnum.Enable.getKey());
|