数字征信--征信画像:个人情况与违约、个人征信:影响因素分许实训任务

de'v
@t2652009480 11 months ago
parent e9b9d793f9
commit 023c8ba155

@ -0,0 +1,37 @@
package com.sztzjy.digital_credit.config.exception.handler;
import org.springframework.http.HttpStatus;
public class DigitalEconomyxception extends RuntimeException {
private HttpStatus code;
private String msg;
public DigitalEconomyxception() {
}
public DigitalEconomyxception(HttpStatus code) {
this.code = code;
}
public DigitalEconomyxception(HttpStatus code, String msg) {
super(msg);
this.code = code;
this.msg = msg;
}
public HttpStatus getCode() {
return code;
}
public void setCode(HttpStatus code) {
this.code = code;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
}

@ -0,0 +1,99 @@
package com.sztzjy.digital_credit.controller;
import cn.hutool.core.util.IdUtil;
import com.sztzjy.digital_credit.annotation.AnonymousAccess;
import com.sztzjy.digital_credit.config.Constant;
import com.sztzjy.digital_credit.config.exception.handler.DigitalEconomyxception;
import com.sztzjy.digital_credit.entity.StuBreachOfContractTraining;
import com.sztzjy.digital_credit.entity.StuBreachOfContractTrainingExample;
import com.sztzjy.digital_credit.entity.dto.EducationAndBreachOfContractDTO;
import com.sztzjy.digital_credit.mapper.StuBreachOfContractTrainingMapper;
import com.sztzjy.digital_credit.util.ResultEntity;
import com.sztzjy.digital_credit.util.excel.FilePortUtil;
import com.sztzjy.digital_credit.util.excel.ImportExcelUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import javax.imageio.ImageIO;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.net.URLEncoder;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.UUID;
/**
* @author tz
* @date 2024/4/26 17:41
*/
@Api(tags = "实训任务")
@RestController
@RequestMapping("api/stu/trainingTask")
public class StuCreditPortraitTrainingController {
@Resource
StuBreachOfContractTrainingMapper trainingMapper;
@ApiOperation("征信画像--个人情况与违约:学历与违约数据比较")
@AnonymousAccess
@PostMapping("/dataComparison")
public ResultEntity dataComparison(@RequestBody List<EducationAndBreachOfContractDTO> contractDTOS){
return new ResultEntity<>(HttpStatus.OK,"成功");
}
@ApiOperation("逾期记录--生成逾期证明")
@AnonymousAccess
@GetMapping("/generatePaperBackground")
protected void doGet(HttpServletResponse response) throws IOException {
response.setContentType("image/png");
// 创建纸张背景图像
BufferedImage paperBackground = new BufferedImage(1200, 400, BufferedImage.TYPE_INT_RGB);
Graphics2D g2d = paperBackground.createGraphics();
// 设置纸张背景颜色
g2d.setColor(Color.WHITE);
g2d.fillRect(0, 0, paperBackground.getWidth(), paperBackground.getHeight());
// 设置字体样式
Font font = new Font("SimSun", Font.PLAIN, 14);
g2d.setFont(font);
g2d.setColor(Color.BLACK);
// 读取文本文件内容
String textFilePath = "D:\\home\\text\\content.txt";
List<String> lines = Files.readAllLines(Paths.get(textFilePath));
// 计算文本的起始位置(这里简单地从上往下逐行绘制)
int textY = 50; // 起始Y坐标可以根据需要调整
for (String line : lines) {
g2d.drawString(line, 50, textY); // 起始X坐标设置为50可以根据需要调整
textY += g2d.getFontMetrics().getHeight(); // 更新Y坐标以绘制下一行
}
// 释放Graphics2D资源
g2d.dispose();
// 将图像写入到响应输出流中
try (ByteArrayOutputStream baos = new ByteArrayOutputStream()) {
ImageIO.write(paperBackground, "png", baos);
byte[] imageBytes = baos.toByteArray();
response.getOutputStream().write(imageBytes);
}
}
}

@ -0,0 +1,64 @@
package com.sztzjy.digital_credit.entity;
import io.swagger.annotations.ApiModelProperty;
/**
*
* @author tz
* stu_breach_of_contract_training
*/
public class StuBreachOfContractTraining {
@ApiModelProperty("ID")
private Integer id;
@ApiModelProperty("序号")
private Integer number;
@ApiModelProperty("姓名")
private String name;
@ApiModelProperty("学历")
private String educationalBackground;
@ApiModelProperty("是否违约")
private String defaultSituation;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getNumber() {
return number;
}
public void setNumber(Integer number) {
this.number = number;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name == null ? null : name.trim();
}
public String getEducationalBackground() {
return educationalBackground;
}
public void setEducationalBackground(String educationalBackground) {
this.educationalBackground = educationalBackground == null ? null : educationalBackground.trim();
}
public String getDefaultSituation() {
return defaultSituation;
}
public void setDefaultSituation(String defaultSituation) {
this.defaultSituation = defaultSituation == null ? null : defaultSituation.trim();
}
}

@ -0,0 +1,529 @@
package com.sztzjy.digital_credit.entity;
import java.util.ArrayList;
import java.util.List;
public class StuBreachOfContractTrainingExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public StuBreachOfContractTrainingExample() {
oredCriteria = new ArrayList<>();
}
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
public String getOrderByClause() {
return orderByClause;
}
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
public boolean isDistinct() {
return distinct;
}
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andIdIsNull() {
addCriterion("id is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("id is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(Integer value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(Integer value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(Integer value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(Integer value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(Integer value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(Integer value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<Integer> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<Integer> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(Integer value1, Integer value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(Integer value1, Integer value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andNumberIsNull() {
addCriterion("number is null");
return (Criteria) this;
}
public Criteria andNumberIsNotNull() {
addCriterion("number is not null");
return (Criteria) this;
}
public Criteria andNumberEqualTo(Integer value) {
addCriterion("number =", value, "number");
return (Criteria) this;
}
public Criteria andNumberNotEqualTo(Integer value) {
addCriterion("number <>", value, "number");
return (Criteria) this;
}
public Criteria andNumberGreaterThan(Integer value) {
addCriterion("number >", value, "number");
return (Criteria) this;
}
public Criteria andNumberGreaterThanOrEqualTo(Integer value) {
addCriterion("number >=", value, "number");
return (Criteria) this;
}
public Criteria andNumberLessThan(Integer value) {
addCriterion("number <", value, "number");
return (Criteria) this;
}
public Criteria andNumberLessThanOrEqualTo(Integer value) {
addCriterion("number <=", value, "number");
return (Criteria) this;
}
public Criteria andNumberIn(List<Integer> values) {
addCriterion("number in", values, "number");
return (Criteria) this;
}
public Criteria andNumberNotIn(List<Integer> values) {
addCriterion("number not in", values, "number");
return (Criteria) this;
}
public Criteria andNumberBetween(Integer value1, Integer value2) {
addCriterion("number between", value1, value2, "number");
return (Criteria) this;
}
public Criteria andNumberNotBetween(Integer value1, Integer value2) {
addCriterion("number not between", value1, value2, "number");
return (Criteria) this;
}
public Criteria andNameIsNull() {
addCriterion("name is null");
return (Criteria) this;
}
public Criteria andNameIsNotNull() {
addCriterion("name is not null");
return (Criteria) this;
}
public Criteria andNameEqualTo(String value) {
addCriterion("name =", value, "name");
return (Criteria) this;
}
public Criteria andNameNotEqualTo(String value) {
addCriterion("name <>", value, "name");
return (Criteria) this;
}
public Criteria andNameGreaterThan(String value) {
addCriterion("name >", value, "name");
return (Criteria) this;
}
public Criteria andNameGreaterThanOrEqualTo(String value) {
addCriterion("name >=", value, "name");
return (Criteria) this;
}
public Criteria andNameLessThan(String value) {
addCriterion("name <", value, "name");
return (Criteria) this;
}
public Criteria andNameLessThanOrEqualTo(String value) {
addCriterion("name <=", value, "name");
return (Criteria) this;
}
public Criteria andNameLike(String value) {
addCriterion("name like", value, "name");
return (Criteria) this;
}
public Criteria andNameNotLike(String value) {
addCriterion("name not like", value, "name");
return (Criteria) this;
}
public Criteria andNameIn(List<String> values) {
addCriterion("name in", values, "name");
return (Criteria) this;
}
public Criteria andNameNotIn(List<String> values) {
addCriterion("name not in", values, "name");
return (Criteria) this;
}
public Criteria andNameBetween(String value1, String value2) {
addCriterion("name between", value1, value2, "name");
return (Criteria) this;
}
public Criteria andNameNotBetween(String value1, String value2) {
addCriterion("name not between", value1, value2, "name");
return (Criteria) this;
}
public Criteria andEducationalBackgroundIsNull() {
addCriterion("educational_background is null");
return (Criteria) this;
}
public Criteria andEducationalBackgroundIsNotNull() {
addCriterion("educational_background is not null");
return (Criteria) this;
}
public Criteria andEducationalBackgroundEqualTo(String value) {
addCriterion("educational_background =", value, "educationalBackground");
return (Criteria) this;
}
public Criteria andEducationalBackgroundNotEqualTo(String value) {
addCriterion("educational_background <>", value, "educationalBackground");
return (Criteria) this;
}
public Criteria andEducationalBackgroundGreaterThan(String value) {
addCriterion("educational_background >", value, "educationalBackground");
return (Criteria) this;
}
public Criteria andEducationalBackgroundGreaterThanOrEqualTo(String value) {
addCriterion("educational_background >=", value, "educationalBackground");
return (Criteria) this;
}
public Criteria andEducationalBackgroundLessThan(String value) {
addCriterion("educational_background <", value, "educationalBackground");
return (Criteria) this;
}
public Criteria andEducationalBackgroundLessThanOrEqualTo(String value) {
addCriterion("educational_background <=", value, "educationalBackground");
return (Criteria) this;
}
public Criteria andEducationalBackgroundLike(String value) {
addCriterion("educational_background like", value, "educationalBackground");
return (Criteria) this;
}
public Criteria andEducationalBackgroundNotLike(String value) {
addCriterion("educational_background not like", value, "educationalBackground");
return (Criteria) this;
}
public Criteria andEducationalBackgroundIn(List<String> values) {
addCriterion("educational_background in", values, "educationalBackground");
return (Criteria) this;
}
public Criteria andEducationalBackgroundNotIn(List<String> values) {
addCriterion("educational_background not in", values, "educationalBackground");
return (Criteria) this;
}
public Criteria andEducationalBackgroundBetween(String value1, String value2) {
addCriterion("educational_background between", value1, value2, "educationalBackground");
return (Criteria) this;
}
public Criteria andEducationalBackgroundNotBetween(String value1, String value2) {
addCriterion("educational_background not between", value1, value2, "educationalBackground");
return (Criteria) this;
}
public Criteria andDefaultSituationIsNull() {
addCriterion("default_situation is null");
return (Criteria) this;
}
public Criteria andDefaultSituationIsNotNull() {
addCriterion("default_situation is not null");
return (Criteria) this;
}
public Criteria andDefaultSituationEqualTo(String value) {
addCriterion("default_situation =", value, "defaultSituation");
return (Criteria) this;
}
public Criteria andDefaultSituationNotEqualTo(String value) {
addCriterion("default_situation <>", value, "defaultSituation");
return (Criteria) this;
}
public Criteria andDefaultSituationGreaterThan(String value) {
addCriterion("default_situation >", value, "defaultSituation");
return (Criteria) this;
}
public Criteria andDefaultSituationGreaterThanOrEqualTo(String value) {
addCriterion("default_situation >=", value, "defaultSituation");
return (Criteria) this;
}
public Criteria andDefaultSituationLessThan(String value) {
addCriterion("default_situation <", value, "defaultSituation");
return (Criteria) this;
}
public Criteria andDefaultSituationLessThanOrEqualTo(String value) {
addCriterion("default_situation <=", value, "defaultSituation");
return (Criteria) this;
}
public Criteria andDefaultSituationLike(String value) {
addCriterion("default_situation like", value, "defaultSituation");
return (Criteria) this;
}
public Criteria andDefaultSituationNotLike(String value) {
addCriterion("default_situation not like", value, "defaultSituation");
return (Criteria) this;
}
public Criteria andDefaultSituationIn(List<String> values) {
addCriterion("default_situation in", values, "defaultSituation");
return (Criteria) this;
}
public Criteria andDefaultSituationNotIn(List<String> values) {
addCriterion("default_situation not in", values, "defaultSituation");
return (Criteria) this;
}
public Criteria andDefaultSituationBetween(String value1, String value2) {
addCriterion("default_situation between", value1, value2, "defaultSituation");
return (Criteria) this;
}
public Criteria andDefaultSituationNotBetween(String value1, String value2) {
addCriterion("default_situation not between", value1, value2, "defaultSituation");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
}

@ -0,0 +1,16 @@
package com.sztzjy.digital_credit.entity.dto;
import lombok.Data;
/**
* --
* @author tz
* @date 2024/4/28 10:40
*/
@Data
public class EducationAndBreachOfContractDTO {
private String education;
private String numberOfPeople;
private String numberOfDefaultingPeople;
private String defaultRate;
}

@ -0,0 +1,32 @@
package com.sztzjy.digital_credit.mapper;
import com.sztzjy.digital_credit.entity.StuBreachOfContractTraining;
import com.sztzjy.digital_credit.entity.StuBreachOfContractTrainingExample;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@Mapper
public interface StuBreachOfContractTrainingMapper {
long countByExample(StuBreachOfContractTrainingExample example);
int deleteByExample(StuBreachOfContractTrainingExample example);
int deleteByPrimaryKey(Integer id);
int insert(StuBreachOfContractTraining record);
int insertSelective(StuBreachOfContractTraining record);
List<StuBreachOfContractTraining> selectByExample(StuBreachOfContractTrainingExample example);
StuBreachOfContractTraining selectByPrimaryKey(Integer id);
int updateByExampleSelective(@Param("record") StuBreachOfContractTraining record, @Param("example") StuBreachOfContractTrainingExample example);
int updateByExample(@Param("record") StuBreachOfContractTraining record, @Param("example") StuBreachOfContractTrainingExample example);
int updateByPrimaryKeySelective(StuBreachOfContractTraining record);
int updateByPrimaryKey(StuBreachOfContractTraining record);
}

@ -5,6 +5,7 @@ import com.sztzjy.digital_credit.entity.*;
import com.sztzjy.digital_credit.mapper.*;
import com.sztzjy.digital_credit.service.StuPersonalCreditReportingService;
import com.sztzjy.digital_credit.service.StuPersonalCreditService;
import com.sztzjy.digital_credit.service.StuRateService;
import com.sztzjy.digital_credit.util.BigDecimalUtils;
import org.springframework.stereotype.Service;
@ -29,6 +30,8 @@ public class StuPersonalCreditServiceImpl implements StuPersonalCreditService {
TchModuleWeithMapper tchModuleWeithMapper;
@Resource
StuPersonalCreditReportingService stuPersonalCreditReportingService;
@Resource
StuRateService service;
/**
*
@ -538,23 +541,28 @@ public class StuPersonalCreditServiceImpl implements StuPersonalCreditService {
stuScoreCenter.setLearningProjects(module);
stuScoreCenter.setTrainingTotalScore(BigDecimal.valueOf(100));
//设置权重
//设置权重和完成情况
Boolean schedule;
if(module.equals(Constant.PERSONAL_CREDIT)){
stuScoreCenter.setScoreWeight(tchModuleWeith.getCasePersonalCreditWeith());
stuScoreCenter.setScoreWeight(tchModuleWeith.getCasePersonalCreditWeith()); //个人征信--权重
schedule= stuPersonalCreditReportingService.getSchedule(userId); //个人征信--完成情况
}else {
stuScoreCenter.setScoreWeight(tchModuleWeith.getCaseCorporateCreditWeith());
stuScoreCenter.setScoreWeight(tchModuleWeith.getCaseCorporateCreditWeith()); //企业征信--权重
schedule=service.completionStatusOfEnterprise(userId); //企业征信--完成情况
}
//设置得分信息
stuScoreCenter.setTrainingScore(score);
stuScoreCenter.setTrainingScoreOne(score);
//完成情况
boolean schedule = stuPersonalCreditReportingService.getSchedule(userId);
if(schedule){
stuScoreCenter.setCompletionStatus("已完成");
}else {
stuScoreCenter.setCompletionStatus("未完成");
}
//设置得分信息
stuScoreCenter.setTrainingScore(score);
stuScoreCenter.setTrainingScoreOne(score);
stuScoreCenter.setUserId(userId);
stuScoreCenter.setModule(module);
stuScoreCenter.setAscription(Constant.COMPREHENSIVE_CASE);

@ -6,6 +6,7 @@ import com.sztzjy.digital_credit.mapper.*;
import com.sztzjy.digital_credit.service.StuPersonalCreditReportingService;
import com.sztzjy.digital_credit.service.StuPersonalCreditService;
import org.springframework.beans.BeanUtils;
import org.springframework.context.annotation.Lazy;
import org.springframework.security.core.parameters.P;
import org.springframework.stereotype.Service;
@ -23,6 +24,7 @@ import java.util.UUID;
public class StuPersonalInfoEntryServiceImpl implements StuPersonalCreditReportingService {
@Resource
StuPersonalInfoMapper stuPersonalInfoMapper;
@Lazy
@Resource
StuPersonalCreditService stuPersonalCreditService;
@Resource

@ -0,0 +1,149 @@
package com.sztzjy.digital_credit.util.excel;
import org.apache.poi.hssf.usermodel.HSSFDateUtil;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.stereotype.Component;
import java.io.InputStream;
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;
@Component
public class ImportExcelUtil {
private final static String excel2003L = ".xls"; //2003- 版本的excel
private final static String excel2007U = ".xlsx"; //2007+ 版本的excel
/**
* IOList<List<Object>>
*
* @param in,fileName
* @return
* @throws Exception
*/
public static List<List<Object>> getListByExcel(InputStream in, String fileName) throws Exception {
List<List<Object>> list = null;
//创建Excel工作薄
Workbook work = ImportExcelUtil.getWorkbook(in, fileName);
if (null == work) {
throw new Exception("创建Excel工作薄为空");
}
Sheet sheet = null;
Row row = null;
Cell cell = null;
list = new ArrayList<List<Object>>();
//遍历Excel中所有的sheet
for (int i = 0; i < work.getNumberOfSheets(); i++) {
sheet = work.getSheetAt(i);
if (sheet == null) {
continue;
}
//遍历当前sheet中的所有行
for (int j = sheet.getFirstRowNum(); j < sheet.getLastRowNum() + 1; j++) {
row = sheet.getRow(j);
if (row == null || row.getFirstCellNum() == j) {
continue;
}
//遍历所有的列
List<Object> li = new ArrayList<Object>();
for (int y = row.getFirstCellNum(); y < row.getLastCellNum(); y++) {
cell = row.getCell(y);
li.add(ImportExcelUtil.getCellValue(cell));
}
list.add(li);
}
}
// work.close();
return list;
}
/**
*
*
* @param inStr,fileName
* @return
* @throws Exception
*/
public static Workbook getWorkbook(InputStream inStr, String fileName) throws Exception {
Workbook wb = null;
String fileType = fileName.substring(fileName.lastIndexOf("."));
if (excel2003L.equals(fileType)) {
wb = new HSSFWorkbook(inStr); //2003-
} else if (excel2007U.equals(fileType)) {
wb = new XSSFWorkbook(inStr); //2007+
} else {
throw new Exception("解析的文件格式有误!");
}
return wb;
}
/**
*
*
* @param cell
* @return
*/
public static Object getCellValue(Cell cell) {
Object val = null;
DecimalFormat df = new DecimalFormat("0"); //格式化number String字符
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
// SimpleDateFormat sdf = new SimpleDateFormat("yyy-MM-dd"); //日期格式化
// DecimalFormat df2 = new DecimalFormat("0.00"); //格式化数字
if (cell != null) {
if (cell.getCellTypeEnum() == CellType.NUMERIC || cell.getCellTypeEnum() == CellType.FORMULA) {
val = cell.getNumericCellValue();
if (HSSFDateUtil.isCellDateFormatted(cell)) {
val = DateUtil.getJavaDate((Double) val); // POI Excel 日期格式转换
} else {
if ((Double) val % 1 > 0) {
val = new BigDecimal(val.toString());
} else {
val = new DecimalFormat("0").format(val);
}
}
} else if (cell.getCellTypeEnum() == CellType.STRING) {
val = cell.getStringCellValue();
} else if (cell.getCellTypeEnum() == CellType.BOOLEAN) {
val = cell.getBooleanCellValue();
} else if (cell.getCellTypeEnum() == CellType.ERROR) {
val = cell.getErrorCellValue();
}
// switch (cell.getCellType()) {
// case Cell.CELL_TYPE_STRING:
// value = cell.getRichStringCellValue().getString();
// break;
// case Cell.CELL_TYPE_NUMERIC:
// if("General".equals(cell.getCellStyle().getDataFormatString())){
// value = df.format(cell.getNumericCellValue());
// }
// else if("m/d/yy".equals(cell.getCellStyle().getDataFormatString())){
// value = sdf.format(cell.getDateCellValue());
// }
// else{
// value = sdf.format(cell.getDateCellValue());
// }
// break;
// case Cell.CELL_TYPE_BOOLEAN:
// value = cell.getBooleanCellValue();
// break;
// case Cell.CELL_TYPE_BLANK:
// value = "";
// break;
// default:
// break;
// }
}
return val;
}
}

@ -62,10 +62,11 @@
<!-- <table tableName="stu_personal_overdue_info" domainObjectName="StuPersonalOverdueInfo"/>-->
<!-- <table tableName="stu_base_info" domainObjectName="StuBaseInfo"/>-->
<!-- <table tableName="stu_credit_score" domainObjectName="StuCreditScore"/>-->
<table tableName="stu_score_center" domainObjectName="StuScoreCenter" />
<!-- <table tableName="stu_score_center" domainObjectName="StuScoreCenter" />-->
<!-- <table tableName="tch_module_weith" domainObjectName="TchModuleWeith" />-->
<!-- <table tableName="tch_assessment_points" domainObjectName="TchAssessmentPoints" />-->
<!-- <table tableName="training_report" domainObjectName="TrainingReport" />-->
<table tableName="stu_breach_of_contract_training" domainObjectName="StuBreachOfContractTraining" />
</context>

@ -0,0 +1,213 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.sztzjy.digital_credit.mapper.StuBreachOfContractTrainingMapper">
<resultMap id="BaseResultMap" type="com.sztzjy.digital_credit.entity.StuBreachOfContractTraining">
<id column="id" jdbcType="INTEGER" property="id" />
<result column="number" jdbcType="INTEGER" property="number" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="educational_background" jdbcType="VARCHAR" property="educationalBackground" />
<result column="default_situation" jdbcType="VARCHAR" property="defaultSituation" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
id, number, name, educational_background, default_situation
</sql>
<select id="selectByExample" parameterType="com.sztzjy.digital_credit.entity.StuBreachOfContractTrainingExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from stu_breach_of_contract_training
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from stu_breach_of_contract_training
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from stu_breach_of_contract_training
where id = #{id,jdbcType=INTEGER}
</delete>
<delete id="deleteByExample" parameterType="com.sztzjy.digital_credit.entity.StuBreachOfContractTrainingExample">
delete from stu_breach_of_contract_training
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="com.sztzjy.digital_credit.entity.StuBreachOfContractTraining">
insert into stu_breach_of_contract_training (id, number, name,
educational_background, default_situation
)
values (#{id,jdbcType=INTEGER}, #{number,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR},
#{educationalBackground,jdbcType=VARCHAR}, #{defaultSituation,jdbcType=VARCHAR}
)
</insert>
<insert id="insertSelective" parameterType="com.sztzjy.digital_credit.entity.StuBreachOfContractTraining">
insert into stu_breach_of_contract_training
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="number != null">
number,
</if>
<if test="name != null">
name,
</if>
<if test="educationalBackground != null">
educational_background,
</if>
<if test="defaultSituation != null">
default_situation,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=INTEGER},
</if>
<if test="number != null">
#{number,jdbcType=INTEGER},
</if>
<if test="name != null">
#{name,jdbcType=VARCHAR},
</if>
<if test="educationalBackground != null">
#{educationalBackground,jdbcType=VARCHAR},
</if>
<if test="defaultSituation != null">
#{defaultSituation,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.sztzjy.digital_credit.entity.StuBreachOfContractTrainingExample" resultType="java.lang.Long">
select count(*) from stu_breach_of_contract_training
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update stu_breach_of_contract_training
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=INTEGER},
</if>
<if test="record.number != null">
number = #{record.number,jdbcType=INTEGER},
</if>
<if test="record.name != null">
name = #{record.name,jdbcType=VARCHAR},
</if>
<if test="record.educationalBackground != null">
educational_background = #{record.educationalBackground,jdbcType=VARCHAR},
</if>
<if test="record.defaultSituation != null">
default_situation = #{record.defaultSituation,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update stu_breach_of_contract_training
set id = #{record.id,jdbcType=INTEGER},
number = #{record.number,jdbcType=INTEGER},
name = #{record.name,jdbcType=VARCHAR},
educational_background = #{record.educationalBackground,jdbcType=VARCHAR},
default_situation = #{record.defaultSituation,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="com.sztzjy.digital_credit.entity.StuBreachOfContractTraining">
update stu_breach_of_contract_training
<set>
<if test="number != null">
number = #{number,jdbcType=INTEGER},
</if>
<if test="name != null">
name = #{name,jdbcType=VARCHAR},
</if>
<if test="educationalBackground != null">
educational_background = #{educationalBackground,jdbcType=VARCHAR},
</if>
<if test="defaultSituation != null">
default_situation = #{defaultSituation,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.sztzjy.digital_credit.entity.StuBreachOfContractTraining">
update stu_breach_of_contract_training
set number = #{number,jdbcType=INTEGER},
name = #{name,jdbcType=VARCHAR},
educational_background = #{educationalBackground,jdbcType=VARCHAR},
default_situation = #{defaultSituation,jdbcType=VARCHAR}
where id = #{id,jdbcType=INTEGER}
</update>
</mapper>
Loading…
Cancel
Save