|
|
@@ -8,10 +8,12 @@ import com.dk.common.response.ResponseCodeEnum;
|
|
|
import com.dk.common.response.ResponseResultUtil;
|
|
|
import com.dk.common.response.ResponseResultVO;
|
|
|
import com.dk.mdm.infrastructure.convert.mst.SaleChannelConvert;
|
|
|
+import com.dk.mdm.infrastructure.util.AuthUtils;
|
|
|
import com.dk.mdm.model.pojo.mst.SaleChannel;
|
|
|
import com.dk.mdm.mapper.mst.SaleChannelMapper;
|
|
|
import com.dk.common.service.BaseService;
|
|
|
import com.dk.common.mapper.BaseMapper;
|
|
|
+import com.dk.mdm.model.pojo.mst.Warehouse;
|
|
|
import com.dk.mdm.model.query.mst.SaleChannelQuery;
|
|
|
import com.dk.mdm.model.response.mst.SaleChannelResponse;
|
|
|
import com.dk.mdm.model.response.mst.WarehouseResponse;
|
|
|
@@ -44,6 +46,10 @@ public class SaleChannelService extends BaseService<SaleChannel> {
|
|
|
@Autowired
|
|
|
private SaleChannelConvert saleChannelConvert;
|
|
|
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private AuthUtils authUtils;
|
|
|
+
|
|
|
/**
|
|
|
* @desc : 重写主键
|
|
|
* @author : 于继渤
|
|
|
@@ -91,6 +97,11 @@ public class SaleChannelService extends BaseService<SaleChannel> {
|
|
|
if(saleChannelResponses.size() > 0){
|
|
|
return ResponseResultUtil.error(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.SALECHANNEL_NAME_NOT.getMessage());
|
|
|
}else{
|
|
|
+ //新建如果是默认取消其他默认
|
|
|
+ if(saleChannelVO.getFlgDefault()){
|
|
|
+ //默认 把其他置为非默认
|
|
|
+ saleChannelMapper.updateFlgDefault(authUtils.getStaff().getCpId());
|
|
|
+ }
|
|
|
//新建
|
|
|
saleChannelMapper.insert(saleChannel);
|
|
|
}
|
|
|
@@ -112,6 +123,11 @@ public class SaleChannelService extends BaseService<SaleChannel> {
|
|
|
rollbackFor = {Exception.class}
|
|
|
)
|
|
|
public ResponseResultVO<?> update(SaleChannelVO saleChannelVO) {
|
|
|
+ SaleChannel saleChannel1 = saleChannelMapper.selectById(saleChannelVO.getChannelId());
|
|
|
+ if ((saleChannel1.getFlgDefault() == null || !saleChannel1.getFlgDefault()) && saleChannelVO.getFlgDefault() != null && saleChannelVO.getFlgDefault()) {
|
|
|
+ //默认 把其他置为非默认
|
|
|
+ saleChannelMapper.updateFlgDefault(saleChannelVO.getCpId());
|
|
|
+ }
|
|
|
SaleChannel saleChannel = saleChannelConvert.convertToPo(saleChannelVO);
|
|
|
super.updateByUuid(saleChannel);
|
|
|
return ResponseResultUtil.success();
|