Merge remote-tracking branch 'origin/master'

master
chen 4 years ago
commit 815c5492c7
  1. 4
      dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/mapper/DgApplyAmountInfoMapper.java
  2. 36
      dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/service/impl/DgApplyAmountInfoServiceImpl.java
  3. 11
      dq-financial-guarantee/src/main/resources/mapper/guarantee/DgApplyAmountInfoMapper.xml

@ -29,4 +29,8 @@ public interface DgApplyAmountInfoMapper extends BaseMapper<DgApplyAmountInfo> {
DgApplyAmountInfoResponse selectApplyAmountInfoById(Integer id);
List<BusinessApplicationListResponse> selectListByIds(List<String> ids);
int selectBusinessTaday(@Param("dateTime") String dateTime);
String selectMaxBusinessTaday(String dateTime);
}

@ -10,10 +10,7 @@ import com.daqing.financial.guarantee.feign.CrmsFeignService;
import com.daqing.financial.guarantee.feign.HrmsFeignService;
import com.daqing.financial.guarantee.mapper.*;
import com.daqing.financial.guarantee.model.request.BusinessApplicationRequest;
import com.daqing.financial.guarantee.model.response.BusinessApplicationDetailResponse;
import com.daqing.financial.guarantee.model.response.BusinessApplicationListResponse;
import com.daqing.financial.guarantee.model.response.DgApplyAmountInfoResponse;
import com.daqing.financial.guarantee.model.response.DgEnclosureInfoResponse;
import com.daqing.financial.guarantee.model.response.*;
import com.daqing.financial.guarantee.service.IDgApplyAmountInfoService;
import com.daqing.financial.guarantee.util.ArraysUtil;
import com.daqing.financial.guarantee.util.AuditProcessUtil;
@ -40,10 +37,8 @@ import org.springframework.web.context.request.ServletRequestAttributes;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.List;
import java.text.SimpleDateFormat;
import java.util.*;
/**
* <p>
@ -125,7 +120,30 @@ public class DgApplyAmountInfoServiceImpl extends ServiceImpl<DgApplyAmountInfoM
dgApplyAmountInfo.setDescription(businessApplication.getDescription());//反担保措施描述
dgApplyAmountInfo.setBusinessType(businessApplication.getBusinessType());//业务类型
dgApplyAmountInfo.setCustomerType(businessApplication.getCustomerType());//客户类型
dgApplyAmountInfo.setBusinessCode(RandomUtil.getRandomNum(12));
//设置业务编号,查询今天是否申请过业务
String businessCode=null;
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String dateTime=sdf.format(new Date());
String timeCode=dateTime.replaceAll("-","");
int count = dgApplyAmountInfoMapper.selectBusinessTaday(dateTime);
if(count ==0){//今天没有申请过业务,所以编号从001开始
if(businessApplication.getBusinessType().equals("融资担保")){//融资业务:RZ-20201231001
businessCode="RZ-"+timeCode+"001";
}else{//非融资业务:FRZ-20201231001
businessCode="FRZ-"+timeCode+"001";
}
}else{
//查询最大业务编号
String code = dgApplyAmountInfoMapper.selectMaxBusinessTaday(dateTime);
int codeNumber = Integer.parseInt(code.substring(code.length() - 3));
String newBusinessCode = String.format("%03d", (codeNumber + 1));
if(businessApplication.getBusinessType().equals("融资担保")){//融资业务:RZ-20201231001
businessCode="RZ-"+timeCode+newBusinessCode;
}else{//非融资业务:FRZ-20201231001
businessCode="FRZ-"+timeCode+newBusinessCode;
}
}
dgApplyAmountInfo.setBusinessCode(businessCode);
dgApplyAmountInfoMapper.insert(dgApplyAmountInfo);

@ -60,4 +60,15 @@
</foreach>
</select>
<select id="selectBusinessTaday" parameterType="java.lang.String" resultType="java.lang.Integer">
select count(0) from dg_apply_amount_info where create_time LIKE CONCAT('%',#{dateTime},'%')
</select>
<select id="selectMaxBusinessTaday" parameterType="java.lang.String" resultType="java.lang.String">
select business_code
from dg_apply_amount_info
where create_time LIKE CONCAT('%',#{dateTime},'%')
order by id desc limit 1
</select>
</mapper>

Loading…
Cancel
Save