|
|
@@ -16,13 +16,11 @@ import javax.mail.MessagingException;
|
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
|
|
-import org.apache.xmlbeans.impl.xb.xsdschema.Public;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
-import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.goafanti.admin.bo.AdminListBo;
|
|
|
@@ -52,7 +50,6 @@ import com.goafanti.common.model.TOrderBack;
|
|
|
import com.goafanti.common.model.TOrderDun;
|
|
|
import com.goafanti.common.model.TOrderLog;
|
|
|
import com.goafanti.common.model.TOrderNew;
|
|
|
-import com.goafanti.common.model.TOrderRefund;
|
|
|
import com.goafanti.common.model.TOrderRefundWithBLOBs;
|
|
|
import com.goafanti.common.model.TOrderTask;
|
|
|
import com.goafanti.common.utils.ExportExcelUtil;
|
|
|
@@ -81,7 +78,6 @@ import com.goafanti.order.enums.TaskState;
|
|
|
import com.goafanti.order.enums.refundState;
|
|
|
import com.goafanti.order.service.OrderNewService;
|
|
|
import com.goafanti.order.service.OrderService;
|
|
|
-import com.mysql.fabric.xmlrpc.base.Data;
|
|
|
|
|
|
@Service
|
|
|
public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> implements OrderNewService {
|
|
|
@@ -248,34 +244,34 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
|
|
|
|
|
|
private void createContractNo(TOrderNew t) {
|
|
|
//根据订单部门或许合同编号前缀
|
|
|
- Map<String, Object> mp;
|
|
|
- mp=organizationManagementMapper.getDepMaxNo(t.getOrderDep());
|
|
|
+ OrganizationManagement dep=organizationManagementMapper.selectByPrimaryKey(t.getOrderDep());
|
|
|
+ if (dep==null||StringUtils.isBlank(dep.getAbbreviation())) {
|
|
|
+ throw new BusinessException(new Error( "该部门缩写不存在","该部门缩写不存在"));
|
|
|
+ }
|
|
|
+ //根据前缀查询最大编号
|
|
|
+ String max=organizationManagementMapper.getMaxAbbreviation(dep.getAbbreviation());
|
|
|
//获取日期年份
|
|
|
Calendar c=Calendar.getInstance();
|
|
|
int y=c.getWeekYear();
|
|
|
- String s=null;
|
|
|
- if(mp!=null)s=(String) mp.get("maxNo");
|
|
|
- if (mp==null) {
|
|
|
- throw new BusinessException(new Error( "该部门缩写不存在","该部门缩写不存在"));
|
|
|
- }
|
|
|
+
|
|
|
String sno=null;
|
|
|
- if (StringUtils.isBlank(s)||s.length()<13) {
|
|
|
- String cn=""+mp.get("abbreviation")+"-"+y+"0001";
|
|
|
- cn=iterationNo(cn,mp.get("abbreviation"),y,1);
|
|
|
+ if (StringUtils.isBlank(max)||max.length()<13) {
|
|
|
+ String cn=""+dep.getAbbreviation()+"-"+y+"0001";
|
|
|
+ cn=iterationNo(cn,dep.getAbbreviation(),y,1);
|
|
|
t.setContractNo(cn);
|
|
|
}else {
|
|
|
- int ty=Integer.parseInt(s.substring(s.indexOf("-")+1, s.length()-4));
|
|
|
- int no=Integer.parseInt(s.substring(s.length()-4, s.length()));
|
|
|
- no++;
|
|
|
+ int ty=Integer.parseInt(max.substring(max.indexOf("-")+1, max.length()-4));
|
|
|
+ int no=Integer.parseInt(max.substring(max.length()-4, max.length()));
|
|
|
+
|
|
|
//得出字符串
|
|
|
- sno = countNo(mp.get("abbreviation"), sno, ty, no);
|
|
|
+ sno = countNo(dep.getAbbreviation(), sno, ty, no);
|
|
|
//迭代得出最后编码
|
|
|
- sno=iterationNo(sno,mp.get("abbreviation"),ty,no);
|
|
|
+ sno=iterationNo(sno,dep.getAbbreviation(),ty,no);
|
|
|
//年份小于等于则获取最大值加1,大于则获取最新年份
|
|
|
if (y<=ty) {
|
|
|
t.setContractNo(sno);
|
|
|
}else {
|
|
|
- t.setContractNo(""+mp.get("abbreviation")+"-"+y+"0001");
|
|
|
+ t.setContractNo(""+dep.getAbbreviation()+"-"+y+"0001");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -284,7 +280,7 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
|
|
|
|
|
|
private String iterationNo(String sno ,Object mp, int ty, int no) {
|
|
|
if (tOrderNewMapper.checkContractNo(sno)>0) {
|
|
|
- int i=Integer.parseInt(sno.substring(sno.indexOf("-")+2, sno.length()-4));
|
|
|
+ int i=Integer.parseInt(sno.substring(sno.indexOf("-")+4, sno.length()-4));
|
|
|
sno=countNo(mp, sno, ty, i);
|
|
|
iterationNo(sno,mp,ty,i);
|
|
|
}
|
|
|
@@ -294,11 +290,12 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
|
|
|
|
|
|
|
|
|
private String countNo(Object object, String sno, int ty, int no) {
|
|
|
+ no++;
|
|
|
if (no>0&&no<10) {
|
|
|
sno=object+"-"+ty+"000"+no;
|
|
|
- }else if (no>10&&no<100) {
|
|
|
+ }else if (no>9&&no<100) {
|
|
|
sno=object+"-"+ty+"00"+no;
|
|
|
- } else if (no>100&&no<1000) {
|
|
|
+ } else if (no>99&&no<1000) {
|
|
|
sno=object+"-"+ty+"0"+no;
|
|
|
} else if(no>1000){
|
|
|
sno=object+"-"+ty+no;
|