|
@@ -10,6 +10,7 @@ import com.diagbot.entity.OpenedProductsIndex;
|
|
|
import com.diagbot.entity.wrapper.LantoneProductWrapper;
|
|
|
import com.diagbot.entity.wrapper.OpendProductWrapper;
|
|
|
import com.diagbot.enums.IsDeleteEnum;
|
|
|
+import com.diagbot.enums.StatusEnum;
|
|
|
import com.diagbot.exception.CommonErrorCode;
|
|
|
import com.diagbot.exception.CommonException;
|
|
|
import com.diagbot.service.impl.LantoneProductServiceImpl;
|
|
@@ -64,6 +65,8 @@ public class LantoneProductFacade extends LantoneProductServiceImpl {
|
|
|
public Boolean updateProduct(UpdateProductVO updateProductVO) {
|
|
|
LantoneProduct lantoneProduct =this.getById(updateProductVO.getId());
|
|
|
BeanUtil.copyProperties(updateProductVO,lantoneProduct);
|
|
|
+ lantoneProduct.setModifier(UserUtils.getCurrentPrincipleID());
|
|
|
+ lantoneProduct.setGmtModified(DateUtil.now());
|
|
|
if (!updateById(lantoneProduct)) {
|
|
|
throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
|
|
|
"产品修改失败");
|
|
@@ -77,6 +80,18 @@ public class LantoneProductFacade extends LantoneProductServiceImpl {
|
|
|
*/
|
|
|
public Boolean deleteProduct(UpdateProductVO updateProductVO) {
|
|
|
LantoneProduct lantoneProduct = getById(updateProductVO.getId());
|
|
|
+ //TODO 判断是否还有用户使用此产品
|
|
|
+ OpenedProductsIndex openedProductsIndex =new OpenedProductsIndex();
|
|
|
+ openedProductsIndex.setId(updateProductVO.getId());
|
|
|
+ openedProductsIndex.setServiceStatus(StatusEnum.Enable.getKey());
|
|
|
+ if(openedProductsFacade.getByProductId(openedProductsIndex).size()!=0){
|
|
|
+ if (!updateById(lantoneProduct)) {
|
|
|
+ throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
|
|
|
+ "本产品还有用户使用,删除失败");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ lantoneProduct.setModifier(UserUtils.getCurrentPrincipleID());
|
|
|
+ lantoneProduct.setGmtModified(DateUtil.now());
|
|
|
lantoneProduct.setIsDeleted(IsDeleteEnum.Y.getName());
|
|
|
if (!updateById(lantoneProduct)) {
|
|
|
throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
|
|
@@ -91,6 +106,8 @@ public class LantoneProductFacade extends LantoneProductServiceImpl {
|
|
|
* @Date: 19:59 2018/9/18
|
|
|
*/
|
|
|
public Boolean productStatus(LantoneProduct lantoneProduct) {
|
|
|
+ lantoneProduct.setModifier(UserUtils.getCurrentPrincipleID());
|
|
|
+ lantoneProduct.setGmtModified(DateUtil.now());
|
|
|
if (!updateById(lantoneProduct)) {
|
|
|
throw new CommonException(CommonErrorCode.FAIL);
|
|
|
}
|