|
|
@@ -22,7 +22,9 @@ import com.goafanti.common.dao.JtBusinessCategoryMapper;
|
|
|
import com.goafanti.common.dao.JtBusinessProjectMapper;
|
|
|
import com.goafanti.common.dao.JtCommodityCommentMapper;
|
|
|
import com.goafanti.common.dao.JtTagMapper;
|
|
|
+import com.goafanti.common.enums.BusinessCategoryModule;
|
|
|
import com.goafanti.common.enums.ProjectAuditStatus;
|
|
|
+import com.goafanti.common.enums.UserAuthentication;
|
|
|
import com.goafanti.common.model.JtBusinessCategory;
|
|
|
import com.goafanti.common.model.JtBusinessProject;
|
|
|
import com.goafanti.common.model.JtTag;
|
|
|
@@ -209,8 +211,81 @@ public class JtBusinessServiceImpl extends BaseMybatisDao<JtBusinessProjectMapp
|
|
|
|
|
|
@Override
|
|
|
public int updateCategory(JtBusinessCategory jtBusinessCategory) {
|
|
|
+ // 层级不会变
|
|
|
// TODO Auto-generated method stub
|
|
|
- return jtBusinessCategoryMapper.updateByPrimaryKeySelective(jtBusinessCategory);
|
|
|
+ //修改不影响结构的数据
|
|
|
+ JtBusinessCategory category = new JtBusinessCategory();
|
|
|
+ category.setId(jtBusinessCategory.getId());
|
|
|
+ category.setImgUrl(jtBusinessCategory.getImgUrl());
|
|
|
+ category.setName(jtBusinessCategory.getName());
|
|
|
+ category.setSummary(jtBusinessCategory.getSummary());
|
|
|
+ jtBusinessCategoryMapper.updateByPrimaryKeySelective(category);
|
|
|
+ //是否修改了模块类别
|
|
|
+ boolean moduleChange = null != jtBusinessCategory.getModule() ? !jtBusinessCategory.getModule().equals(jtBusinessCategory.getNextModule()) : false;
|
|
|
+ //是否有上级id
|
|
|
+ boolean existSuperId = StringUtils.isNotBlank(jtBusinessCategory.getSuperId());
|
|
|
+ //一级更换模块
|
|
|
+ if(moduleChange && !existSuperId){
|
|
|
+ //根据模块获得字母前缀
|
|
|
+ String prefix = BusinessCategoryModule.getStatus(jtBusinessCategory.getNextModule()).toString();
|
|
|
+ //获得当前更改后模块的最大值
|
|
|
+
|
|
|
+ //将最大值加一
|
|
|
+ //得到sort
|
|
|
+ //将模块前面字母替换
|
|
|
+ }
|
|
|
+ //存在上级说明是二级修改到不同模块的某品类中
|
|
|
+ if(existSuperId){
|
|
|
+
|
|
|
+ //根据更改后的上级id获得模块,得到对应的字母
|
|
|
+ //获得当前更改后模块的最大值
|
|
|
+ //将最大值加一
|
|
|
+ //得到sort
|
|
|
+ //将模块前面字母替换
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ //获得上级id
|
|
|
+ //只修改基本数据
|
|
|
+ //jtBusinessCategoryMapper.updateByPrimaryKeySelective(jtBusinessCategory);
|
|
|
+ if(StringUtils.isNotBlank(jtBusinessCategory.getSuperId()) && StringUtils.isNotBlank(jtBusinessCategory.getOldSuperId())){
|
|
|
+ //获得修改前品类id
|
|
|
+ //获得修改后品类id
|
|
|
+ //修改前后id不相等执行以下操作
|
|
|
+ if(!jtBusinessCategory.getSuperId().equals(jtBusinessCategory.getOldSuperId())){
|
|
|
+ //获得修改前品类number1
|
|
|
+ String oldNumber = jtBusinessCategoryMapper.selectByPrimaryKey(jtBusinessCategory.getOldSuperId()).getNumber();
|
|
|
+ //获得修改后品类number2
|
|
|
+ String number = jtBusinessCategoryMapper.selectByPrimaryKey(jtBusinessCategory.getSuperId()).getNumber();
|
|
|
+ //根据修改后的品类id获得最大同级number
|
|
|
+ String newNumber = jtBusinessCategoryMapper.getCurrentMaxNumber(number);
|
|
|
+ Integer n = null != newNumber ? Integer.valueOf(newNumber.substring(newNumber.length() - 2)) : 0;
|
|
|
+ if(n < 99){
|
|
|
+ n += 1;
|
|
|
+ newNumber = newNumber.substring(0,newNumber.length() - 3) + (n<10? "0"+ n : n);
|
|
|
+ } else {
|
|
|
+ newNumber = jtBusinessCategoryMapper.getCurrentMinNumber(number);
|
|
|
+ n = Integer.valueOf(newNumber.substring(newNumber.length() - 2));
|
|
|
+ if(n == 1 || n == 01){
|
|
|
+ return -1;
|
|
|
+ }
|
|
|
+ n -= 1;
|
|
|
+ newNumber = newNumber.substring(0,newNumber.length() - 3) + (n<10? "0"+ n : n);
|
|
|
+
|
|
|
+ }
|
|
|
+ //更新数据
|
|
|
+ jtBusinessCategory.setNumber(oldNumber);
|
|
|
+ jtBusinessCategory.setSort(number.length() + 1);
|
|
|
+ jtBusinessCategory.setName(newNumber);
|
|
|
+ //jtBusinessCategoryMapper.updateNumberPrefix(jtBusinessCategory);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ return 1;//jtBusinessCategoryMapper.updateByPrimaryKeySelective(jtBusinessCategory);
|
|
|
}
|
|
|
|
|
|
|