Commit 844cfbb0 authored by lixiaolei's avatar lixiaolei

submit

parent b92b391e
......@@ -77,12 +77,15 @@ public class BusinessFileController extends BaseController {
* @return
*/
@PostMapping("/upload")
public AjaxResult uploadFolder(@RequestPart("file") MultipartFile file, HttpServletRequest request){
public AjaxResult uploadFolder(@RequestPart("file") MultipartFile file, HttpServletRequest request) {
try {
//获取文件名
String filename = file.getOriginalFilename();
//TODO 校验是否上传同名文件
String businessFileName = request.getHeader("FilePath");
// 上传文件路径
String filePath = RuoYiConfig.getUploadPath()+businessFileName+"/";
// 上传并返回文件全路径
// 上传文件路径
String filePath = RuoYiConfig.getUploadPath() + businessFileName + "/";
// 上传并返回文件全路径
String fileName = FileUploadUtils.upload(filePath, file);
String url = serverConfig.getUrl() + fileName;
AjaxResult ajax = AjaxResult.success();
......
package com.dsk.common.core.domain.entity;
import java.util.Date;
import com.dsk.common.core.domain.BaseEntity;
import com.dsk.common.utils.CheckUtils;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.dsk.common.annotation.Excel;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import javax.validation.constraints.Pattern;
import java.util.Date;
/**
* 项目联系人对象 business_contacts
......@@ -17,7 +13,7 @@ import javax.validation.constraints.Pattern;
* @author lxl
* @date 2023-05-17
*/
public class BusinessContacts extends BaseEntity
public class BusinessContacts
{
private static final long serialVersionUID = 1L;
......@@ -52,10 +48,21 @@ public class BusinessContacts extends BaseEntity
@Excel(name = "维护人员")
private String accendant;
/** 性别(1.男 2.女 0.未知) */
@Excel(name = "性别")
private Integer sex;
/** 创建时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date creatTime;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
/** 修改时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "修改时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date updateTime;
public void setId(Integer id)
{
......@@ -129,14 +136,29 @@ public class BusinessContacts extends BaseEntity
{
return accendant;
}
public void setCreatTime(Date creatTime)
{
this.creatTime = creatTime;
public Date getCreateTime() {
return createTime;
}
public Date getCreatTime()
{
return creatTime;
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public Integer getSex() {
return sex;
}
public void setSex(Integer sex) {
this.sex = sex;
}
@Override
......@@ -150,8 +172,9 @@ public class BusinessContacts extends BaseEntity
.append("position", getPosition())
.append("phone", getPhone())
.append("accendant", getAccendant())
.append("creatTime", getCreatTime())
.append("createTime", getCreateTime())
.append("updateTime", getUpdateTime())
.append("sex", getSex())
.toString();
}
}
package com.dsk.common.core.domain.entity;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.TableField;
import com.dsk.common.annotation.Excel;
import com.dsk.common.core.domain.BaseEntity;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.dsk.common.annotation.Excel;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import java.util.Date;
/**
* 项目详情对象 business_info
*
......
......@@ -8,7 +8,8 @@ import java.util.regex.Pattern;
*/
public class CheckUtils {
public static final String REG_Moblie = "^((13[0-9])|(14(0|[5-7]|9))|(15([0-3]|[5-9]))|(16(2|[5-7]))|(17[0-8])|(18[0-9])|(19([0-3]|[5-9])))\\d{8}$";
public static final String REG_Moblie = "^((13[0-9])|(14(0|[5-7]|9))|(15([0-3]|[5-9]))|(16(2|[5-7]))|(17[0-8])|(18[0-9])|(19([0-3]|[5-9])))\\d{8}$";//手机号
public static final String REG_Landline = "(\\(\\d{3,4}\\)|\\d{3,4}-|\\s)?\\d{8}";//座机号
public static final String REG_EMAIL = "[a-zA-Z0-9]+@[a-zA-Z0-9]+\\.[a-zA-Z0-9]+";
......@@ -35,10 +36,42 @@ public class CheckUtils {
if (phone == null){
return false;
}else {
Pattern p = Pattern.compile(REG_Moblie);
Matcher m = p.matcher(phone);
return m.matches();
Pattern mobilePattern = Pattern.compile(REG_Moblie);
Pattern landlinePattern = Pattern.compile(REG_Landline);
Matcher mobileMatcher = mobilePattern.matcher(phone);
Matcher landlineMatcher = landlinePattern.matcher(phone);
return mobileMatcher.matches() || landlineMatcher.matches();
}
}
/**
* Double小数点前的位数
* @param number
* @return
*/
public static int checkIntegerPlaces(Double number) {
String strNumber = Double.toString(Math.abs(number));
int integerPlaces = strNumber.indexOf('.');
if (integerPlaces == -1) {
return strNumber.length();
} else {
return integerPlaces;
}
}
/**
* Double小数点后的位数
* @param number
* @return
*/
public static int checkDecimalPlaces(Double number) {
String strNumber = Double.toString(Math.abs(number));
int decimalPlaces = 0;
int index = strNumber.indexOf('.');
if (index != -1) {
decimalPlaces = strNumber.length() - index - 1;
}
return decimalPlaces;
}
}
package com.dsk.system.domain;
import com.dsk.common.utils.StringUtils;
import lombok.Data;
/**
......@@ -34,7 +33,7 @@ public class BusinessAddDto {
/**
* 投资估算
*/
private String investmentAmount;
private Double investmentAmount;
/**
* 项目阶段
......@@ -59,8 +58,4 @@ public class BusinessAddDto {
* 客户id
*/
private String customerId;
public Double getInvestmentAmount() {
return StringUtils.isEmpty(investmentAmount) ? null :Double.parseDouble(investmentAmount);
}
}
package com.dsk.system.service.impl;
import java.util.List;
import com.dsk.common.core.domain.entity.BusinessContacts;
import com.dsk.common.exception.base.BaseException;
import com.dsk.common.utils.CheckUtils;
......@@ -12,6 +10,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/**
* 项目联系人Service业务层处理
*
......@@ -58,7 +58,7 @@ public class BusinessContactsServiceImpl implements IBusinessContactsService
@Transactional
public int insertBusinessContacts(BusinessContacts businessContacts)
{
if(!CheckUtils.isPhone(businessContacts.getPhone())) throw new BaseException("500","请输入正确的手机号码");
if(!CheckUtils.isPhone(businessContacts.getPhone())) throw new BaseException("500","请输入正确的电话号码");
return businessContactsMapper.insertBusinessContacts(businessContacts);
}
......@@ -72,7 +72,7 @@ public class BusinessContactsServiceImpl implements IBusinessContactsService
@Transactional
public int updateBusinessContacts(BusinessContacts businessContacts)
{
if(!CheckUtils.isPhone(businessContacts.getPhone())) throw new BaseException("500","请输入正确的手机号码");
if(!CheckUtils.isPhone(businessContacts.getPhone())) throw new BaseException("500","请输入正确的电话号码");
businessContacts.setUpdateTime(DateUtils.getNowDate());
return businessContactsMapper.updateBusinessContacts(businessContacts);
}
......
......@@ -179,6 +179,13 @@ public class BusinessInfoServiceImpl implements IBusinessInfoService {
//新增前查询是否已存在
int count = businessInfoMapper.isRepetitionProjectName(dto.getProjectName(), dto.getUserId());
if (count > 0) return AjaxResult.error("项目名称已存在");
//判断资金Double类型的位数
if (dto.getInvestmentAmount() != null) {
int front = CheckUtils.checkIntegerPlaces(dto.getInvestmentAmount());
int later = CheckUtils.checkDecimalPlaces(dto.getInvestmentAmount());
if (front > 9) return AjaxResult.error("小数点前最多支持9位");
if (later > 6) return AjaxResult.error("小数点后最多支持6位");
}
//新增项目主信息
BusinessInfo businessInfo = new BusinessInfo();
BeanUtil.copyProperties(dto, businessInfo);
......@@ -205,9 +212,16 @@ public class BusinessInfoServiceImpl implements IBusinessInfoService {
@Override
@Transactional
public int updateBusinessInfo(BusinessInfo businessInfo) {
//判断资金Double类型的位数
if (businessInfo.getInvestmentAmount() != null) {
int front = CheckUtils.checkIntegerPlaces(businessInfo.getInvestmentAmount());
int later = CheckUtils.checkDecimalPlaces(businessInfo.getInvestmentAmount());
if (front > 9) throw new BaseException("500", "小数点前最多支持9位");
if (later > 6) throw new BaseException("500", "小数点后最多支持6位");
}
if (StringUtils.isNotEmpty(businessInfo.getConstructionPhone()) && StringUtils.isNotEmpty(businessInfo.getSupervisorPhone())) {
if (!CheckUtils.isPhone(businessInfo.getConstructionPhone()) || !CheckUtils.isPhone(businessInfo.getSupervisorPhone()))
throw new BaseException("500", "请输入正确的手机号码");
throw new BaseException("500", "请输入正确的电话号码");
}
businessInfo.setUpdateTime(DateUtils.getNowDate());
return businessInfoMapper.updateBusinessInfo(businessInfo);
......
package com.dsk.system.service.impl;
import java.util.List;
import java.util.stream.Collectors;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.dsk.common.core.domain.AjaxResult;
import com.dsk.common.core.domain.entity.BusinessRelateCompany;
import com.dsk.common.exception.base.BaseException;
import com.dsk.common.utils.CheckUtils;
import com.dsk.common.utils.DateUtils;
import com.dsk.system.domain.BusinessIdDto;
import com.dsk.system.mapper.BusinessRelateCompanyMapper;
......@@ -16,6 +10,8 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.List;
import java.util.stream.Collectors;
/**
* 项目关联单位Service业务层处理
......@@ -63,7 +59,7 @@ public class BusinessRelateCompanyServiceImpl implements IBusinessRelateCompanyS
@Transactional
public int insertBusinessRelateCompany(BusinessRelateCompany businessRelateCompany)
{
// if(!CheckUtils.isPhone(businessRelateCompany.getPhone())) throw new BaseException("500","请输入正确的手机号码");
// if(!CheckUtils.isPhone(businessRelateCompany.getPhone())) throw new BaseException("500","请输入正确的电话号码");
businessRelateCompany.setCreateTime(DateUtils.getNowDate());
return businessRelateCompanyMapper.insertBusinessRelateCompany(businessRelateCompany);
}
......@@ -78,7 +74,7 @@ public class BusinessRelateCompanyServiceImpl implements IBusinessRelateCompanyS
@Transactional
public int updateBusinessRelateCompany(BusinessRelateCompany businessRelateCompany)
{
// if(!CheckUtils.isPhone(businessRelateCompany.getPhone())) throw new BaseException("500","请输入正确的手机号码");
// if(!CheckUtils.isPhone(businessRelateCompany.getPhone())) throw new BaseException("500","请输入正确的电话号码");
businessRelateCompany.setUpdateTime(DateUtils.getNowDate());
return businessRelateCompanyMapper.updateBusinessRelateCompany(businessRelateCompany);
}
......
......@@ -12,8 +12,9 @@
<result property="office" column="office"/>
<result property="position" column="position"/>
<result property="phone" column="phone"/>
<result property="sex" column="sex"/>
<result property="accendant" column="accendant"/>
<result property="creatTime" column="creat_time"/>
<result property="createTime" column="create_time"/>
<result property="updateTime" column="update_time"/>
</resultMap>
......@@ -26,7 +27,8 @@
position,
phone,
accendant,
creat_time,
sex,
create_time,
update_time
from business_contacts
</sql>
......@@ -41,9 +43,10 @@
<if test="position != null and position != ''">and position = #{position}</if>
<if test="phone != null and phone != ''">and phone = #{phone}</if>
<if test="accendant != null and accendant != ''">and accendant = #{accendant}</if>
<if test="creatTime != null ">and creat_time = #{creatTime}</if>
<if test="createTime != null ">and create_time = #{createTime}</if>
<if test="sex != null ">and sex = #{sex}</if>
</where>
order by creat_time desc
order by update_time desc,id desc
</select>
<select id="selectBusinessContactsById" parameterType="Long" resultMap="BusinessContactsResult">
......@@ -61,8 +64,9 @@
<if test="position != null">position,</if>
<if test="phone != null">phone,</if>
<if test="accendant != null">accendant,</if>
<if test="creatTime != null">creat_time,</if>
<if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if>
<if test="sex != null">sex,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="businessId != null">#{businessId},</if>
......@@ -72,8 +76,9 @@
<if test="position != null">#{position},</if>
<if test="phone != null">#{phone},</if>
<if test="accendant != null">#{accendant},</if>
<if test="creatTime != null">#{creatTime},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="sex != null">#{sex},</if>
</trim>
</insert>
......@@ -87,8 +92,9 @@
<if test="position != null">position = #{position},</if>
<if test="phone != null">phone = #{phone},</if>
<if test="accendant != null">accendant = #{accendant},</if>
<if test="creatTime != null">creat_time = #{creatTime},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="sex != null">sex = #{sex},</if>
</trim>
where id = #{id}
</update>
......
......@@ -92,7 +92,7 @@
i.district_name districtName,
i.investment_amount investmentAmount,
i.construction_unit ownerCompany,
MAX(f.creat_time) followTime,
MAX(f.create_time) followTime,
u.nick_name nickName,
GROUP_CONCAT(DISTINCT l.label) label
FROM business_info i
......@@ -356,7 +356,7 @@
<if test="constructionPhone != null">construction_phone = #{constructionPhone},</if>
<if test="supervisorUnit != null">supervisor_unit = #{supervisorUnit},</if>
<if test="supervisorPrincipal != null">supervisor_principal = #{supervisorPrincipal},</if>
<if test="supervisorPhone != null">evaluation_bid_council = #{supervisorPhone},</if>
<if test="supervisorPhone != null">supervisor_phone = #{supervisorPhone},</if>
</trim>
where id = #{id}
</update>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment