|
@@ -138,13 +138,13 @@ public class CustomerServiceImpl extends CommonBaseServiceImpl<CustomerMapper, C
|
|
|
cu_code = pushMaxnubmer(cu_code, cu_id);
|
|
cu_code = pushMaxnubmer(cu_code, cu_id);
|
|
|
//单号赋值
|
|
//单号赋值
|
|
|
customer.setCu_code(cu_code);
|
|
customer.setCu_code(cu_code);
|
|
|
|
|
+ //新增
|
|
|
if (StringUtils.isEmpty(cu_id) || "0".equals(cu_id.toString())) {
|
|
if (StringUtils.isEmpty(cu_id) || "0".equals(cu_id.toString())) {
|
|
|
//检查名称和编号
|
|
//检查名称和编号
|
|
|
int count = getMapper().validNameAndCodeWhenInsert(customer);
|
|
int count = getMapper().validNameAndCodeWhenInsert(customer);
|
|
|
if (count>0) {
|
|
if (count>0) {
|
|
|
throw new BizException(BizExceptionCode.REPEAT_CUSTOMERCODE);
|
|
throw new BizException(BizExceptionCode.REPEAT_CUSTOMERCODE);
|
|
|
}
|
|
}
|
|
|
- //插入操作
|
|
|
|
|
getMapper().insertSelective(customer);
|
|
getMapper().insertSelective(customer);
|
|
|
cu_id = customer.getId();
|
|
cu_id = customer.getId();
|
|
|
//添加从表传输对象
|
|
//添加从表传输对象
|
|
@@ -173,6 +173,7 @@ public class CustomerServiceImpl extends CommonBaseServiceImpl<CustomerMapper, C
|
|
|
if (insertDetail2.size()>0) {
|
|
if (insertDetail2.size()>0) {
|
|
|
customeraddressMapper.batchInsert(insertDetail2);
|
|
customeraddressMapper.batchInsert(insertDetail2);
|
|
|
}
|
|
}
|
|
|
|
|
+ //更新
|
|
|
}else {
|
|
}else {
|
|
|
//检查名称和编号
|
|
//检查名称和编号
|
|
|
int count = getMapper().validNameAndCodeWhenUpdate(customer);
|
|
int count = getMapper().validNameAndCodeWhenUpdate(customer);
|
|
@@ -180,6 +181,22 @@ public class CustomerServiceImpl extends CommonBaseServiceImpl<CustomerMapper, C
|
|
|
throw new BizException(BizExceptionCode.REPEAT_CUSTOMERCODE);
|
|
throw new BizException(BizExceptionCode.REPEAT_CUSTOMERCODE);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ //有关联时不可修改名称编号
|
|
|
|
|
+ Map<String, Object> map = new HashMap<String, Object>();
|
|
|
|
|
+ map.put("v_id",cu_id);
|
|
|
|
|
+ map.put("v_code", cu_code);
|
|
|
|
|
+ map.put("v_type","cust");
|
|
|
|
|
+ map.put("v_companyid",BaseContextHolder.getCompanyId());
|
|
|
|
|
+ map.put("v_res","");
|
|
|
|
|
+ customerMapper.check(map);
|
|
|
|
|
+ Object result = map.get("v_res");
|
|
|
|
|
+ if(!StringUtils.isEmpty(result)){
|
|
|
|
|
+ count = getMapper().validNameAndCodeWhenRelated(customer);
|
|
|
|
|
+ if (count > 0) {
|
|
|
|
|
+ throw new BizException(BizExceptionCode.BIZ_RELUPDATE_CODEANDNAME);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
//检查期初日期是否已结转
|
|
//检查期初日期是否已结转
|
|
|
count = getMapper().validFinish(cu_id, companyId);
|
|
count = getMapper().validFinish(cu_id, companyId);
|
|
|
if (count > 0) {
|
|
if (count > 0) {
|