修改多店逻辑,增加cp_user_id字段到op_seller_customer_relation

dev_0531
kevin jiang 5 years ago
parent 297432e7e4
commit 02e257b996

@ -387,6 +387,7 @@ public class CustomerService {
insertRelation.setUserId(sellerId); insertRelation.setUserId(sellerId);
insertRelation.setCreateBy(Constants.SYS_OPERATION); insertRelation.setCreateBy(Constants.SYS_OPERATION);
insertRelation.setUpdateBy(Constants.SYS_OPERATION); insertRelation.setUpdateBy(Constants.SYS_OPERATION);
insertRelation.setCpUserId(opCustomer.getCpUserId());
//判断是否有效 //判断是否有效
QueryWrapper<OpSellerCustomerRelation> wrapper = new QueryWrapper<>(); QueryWrapper<OpSellerCustomerRelation> wrapper = new QueryWrapper<>();
@ -409,6 +410,7 @@ public class CustomerService {
opSellerCustomerRelation.setUserId(sellerId); opSellerCustomerRelation.setUserId(sellerId);
opSellerCustomerRelation.setCreateBy(Constants.SYS_OPERATION); opSellerCustomerRelation.setCreateBy(Constants.SYS_OPERATION);
opSellerCustomerRelation.setUpdateBy(Constants.SYS_OPERATION); opSellerCustomerRelation.setUpdateBy(Constants.SYS_OPERATION);
opSellerCustomerRelation.setCpUserId(opCustomer.getCpUserId());
opSellerCustomerRelationDOMapper.updateById(opSellerCustomerRelation); opSellerCustomerRelationDOMapper.updateById(opSellerCustomerRelation);
} }
} }
@ -428,6 +430,7 @@ public class CustomerService {
insertRelation.setUserId(0L); insertRelation.setUserId(0L);
insertRelation.setCreateBy(Constants.SYS_OPERATION); insertRelation.setCreateBy(Constants.SYS_OPERATION);
insertRelation.setUpdateBy(Constants.SYS_OPERATION); insertRelation.setUpdateBy(Constants.SYS_OPERATION);
insertRelation.setCpUserId(opCustomer.getCpUserId());
//判断是否有效 //判断是否有效
QueryWrapper<OpSellerCustomerRelation> wrapper = new QueryWrapper<>(); QueryWrapper<OpSellerCustomerRelation> wrapper = new QueryWrapper<>();

@ -61,4 +61,8 @@ public class OpSellerCustomerRelation {
*/ */
private String updateBy; private String updateBy;
/**
*
*/
private String cpUserId;
} }

@ -37,6 +37,7 @@ import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import java.io.IOException; import java.io.IOException;
@ -237,6 +238,7 @@ public class PoiStoreStaffService {
* *
* @param poiStoreStaffVO * @param poiStoreStaffVO
*/ */
@Transactional(rollbackFor = Exception.class)
public String addStaff(PoiStoreStaffVO poiStoreStaffVO) throws Exception { public String addStaff(PoiStoreStaffVO poiStoreStaffVO) throws Exception {
String staffCode = poiStoreStaffVO.getStaffCode(); String staffCode = poiStoreStaffVO.getStaffCode();
String mobil = poiStoreStaffVO.getMobil(); String mobil = poiStoreStaffVO.getMobil();

@ -1085,17 +1085,17 @@ public class StoreEmployeeService {
QueryWrapper<PrivilageCpUserStoreDO> cpUserRelationQwByStore = new QueryWrapper<>(); QueryWrapper<PrivilageCpUserStoreDO> cpUserRelationQwByStore = new QueryWrapper<>();
cpUserRelationQwByStore.eq("store_id",poiStore.getId()).last("limit 1"); cpUserRelationQwByStore.eq("store_id",poiStore.getId()).last("limit 1");
privilageCpUserStoreDO = privilageCpUserStoreDOMapper.selectOne(cpUserRelationQwByStore); privilageCpUserStoreDO = privilageCpUserStoreDOMapper.selectOne(cpUserRelationQwByStore);
if (privilageCpUserStoreDO != null){ // if (privilageCpUserStoreDO != null){
throw new KiisooException(Constants.MSG_DOMAIN_ENTITY_HAS, Constants.CODE_DOMAIN_ENTITY_HAS); // throw new KiisooException(Constants.MSG_DOMAIN_ENTITY_HAS, Constants.CODE_DOMAIN_ENTITY_HAS);
} // }
if (privilageCpUserDO != null){ if (privilageCpUserDO != null){
//查询关系是否存在 //查询关系是否存在
QueryWrapper<PrivilageCpUserStoreDO> cpUserRelationQwByCpUser = new QueryWrapper<>(); QueryWrapper<PrivilageCpUserStoreDO> cpUserRelationQwByCpUser = new QueryWrapper<>();
cpUserRelationQwByCpUser.eq("cp_user_id",privilageCpUserDO.getId()).last("limit 1"); cpUserRelationQwByCpUser.eq("cp_user_id",privilageCpUserDO.getId()).last("limit 1");
privilageCpUserStoreDO = privilageCpUserStoreDOMapper.selectOne(cpUserRelationQwByCpUser); privilageCpUserStoreDO = privilageCpUserStoreDOMapper.selectOne(cpUserRelationQwByCpUser);
if (privilageCpUserStoreDO != null){ // if (privilageCpUserStoreDO != null){
throw new KiisooException(Constants.MSG_DOMAIN_ENTITY_HAS, Constants.CODE_DOMAIN_ENTITY_HAS); // throw new KiisooException(Constants.MSG_DOMAIN_ENTITY_HAS, Constants.CODE_DOMAIN_ENTITY_HAS);
} // }
privilageCpUserDO.setStatus(1); privilageCpUserDO.setStatus(1);
privilageCpUserDO.setName(name); privilageCpUserDO.setName(name);
privilageCpUserDO.setAlias(alias); privilageCpUserDO.setAlias(alias);
@ -1113,12 +1113,15 @@ public class StoreEmployeeService {
privilageCpUserDO.setPosition("店长"); privilageCpUserDO.setPosition("店长");
privilageCpUserDOMapper.insert(privilageCpUserDO); privilageCpUserDOMapper.insert(privilageCpUserDO);
} }
privilageCpUserStoreDO = new PrivilageCpUserStoreDO();
privilageCpUserStoreDO.setStoreId(poiStore.getId()); if(null == privilageCpUserStoreDO){
privilageCpUserStoreDO.setCpUserId(privilageCpUserDO.getId()); privilageCpUserStoreDO = new PrivilageCpUserStoreDO();
int insert = privilageCpUserStoreDOMapper.insert(privilageCpUserStoreDO); privilageCpUserStoreDO.setStoreId(poiStore.getId());
if (insert == 0){ privilageCpUserStoreDO.setCpUserId(privilageCpUserDO.getId());
throw new KiisooException(Constants.MSG_INSERT_ERROR, Constants.CODE_INSERT_ERROR); int insert = privilageCpUserStoreDOMapper.insert(privilageCpUserStoreDO);
if (insert == 0){
throw new KiisooException(Constants.MSG_INSERT_ERROR, Constants.CODE_INSERT_ERROR);
}
} }
SaveAccountInput saveAccountInput = new SaveAccountInput(); SaveAccountInput saveAccountInput = new SaveAccountInput();
@ -1274,11 +1277,11 @@ public class StoreEmployeeService {
public boolean addStoreStaff(PoiStoreStaffVO poiStoreStaffVO) throws KiisooException { public boolean addStoreStaff(PoiStoreStaffVO poiStoreStaffVO) throws KiisooException {
//查看店铺 //查看店铺
if (poiStoreStaffVO.getStoreCode() != null) { if (poiStoreStaffVO.getStoreCode() == null) {
throw new KiisooException(Constants.MSG_STORE_NO, Constants.CODE_STORE_NO); throw new KiisooException(Constants.MSG_STORE_NO, Constants.CODE_STORE_NO);
} }
if (poiStoreStaffVO.getStaffCode() != null) { if (poiStoreStaffVO.getStaffCode() == null) {
throw new KiisooException(Constants.MSG_STAFF_NO, Constants.CODE_STORE_NO); throw new KiisooException(Constants.MSG_STAFF_NO, Constants.CODE_STORE_NO);
} }

Loading…
Cancel
Save