Browse Source

20201104_跳绳比赛测试完成

tiaosheng
zy_Java 5 years ago
parent
commit
7c951f9717
  1. 2
      cloudutil/src/main/java/com/ccsens/cloudutil/aspect/LogAspect.java
  2. 4
      mt/src/main/java/com/ccsens/mt/bean/dto/CompeteDto.java
  3. 8
      mt/src/main/java/com/ccsens/mt/bean/dto/ProvinceCompeteDto.java
  4. 33
      mt/src/main/java/com/ccsens/mt/bean/po/CompeteGroup.java
  5. 180
      mt/src/main/java/com/ccsens/mt/bean/po/CompeteGroupExample.java
  6. 3
      mt/src/main/java/com/ccsens/mt/service/FileService.java
  7. 53
      mt/src/main/java/com/ccsens/mt/service/ProvinceService.java
  8. 4
      mt/src/main/resources/application.yml
  9. 57
      mt/src/main/resources/mapper_raw/CompeteGroupMapper.xml
  10. BIN
      nullzzz/2020-10-22/1603333027707.xlsx
  11. 20
      tall/src/main/java/com/ccsens/tall/web/UserController.java
  12. 7
      tall/src/main/java/com/ccsens/tall/web/UserInfoController.java
  13. 4
      tall/src/main/resources/application.yml
  14. 28
      util/src/main/java/com/ccsens/util/CodeEnum.java
  15. 13
      util/src/test/java/com/ccsens/util/OtherTest.java

2
cloudutil/src/main/java/com/ccsens/cloudutil/aspect/LogAspect.java

@ -100,7 +100,7 @@ public class LogAspect {
}
LogDto dto = new LogDto();
dto.setUrl(url);
dto.setFacility("");
dto.setFacility(request.getHeader("fingerprint"));
//参数
Object[] args = pjp.getArgs();
StringBuilder param = new StringBuilder();

4
mt/src/main/java/com/ccsens/mt/bean/dto/CompeteDto.java

@ -237,11 +237,11 @@ public class CompeteDto {
@ApiModelProperty("参赛单位id")
private Long companyId;
// @NotEmpty(message = "请输入单位名称")
@Size(min =0,max = 20,message = "单位名称过长")
@Size(min =0,max = 50,message = "单位名称过长")
@ApiModelProperty("单位名称")
private String companyName;
@NotEmpty(message = "姓名不能为空")
@Size(min =0,max = 6 ,message = "联系人姓名过长")
@Size(min =0,max = 50 ,message = "联系人姓名过长")
@ApiModelProperty("主要联系人姓名")
private String contactsName;
@NotEmpty(message = "联系方式不能为空")

8
mt/src/main/java/com/ccsens/mt/bean/dto/ProvinceCompeteDto.java

@ -16,7 +16,7 @@ public class ProvinceCompeteDto {
@Data
@ApiModel("参赛单位id")
public static class CompanyIdVo{
@NotNull(message = "参赛单位错误")
@NotNull(message = "请先填写基础信息")
@ApiModelProperty("参赛单位id")
private Long companyId;
}
@ -33,7 +33,7 @@ public class ProvinceCompeteDto {
@Data
@ApiModel("通过组别查找本单位注册的选手")
public static class QueryPlayerByGroup{
@NotNull
@NotNull(message = "请先填写基础信息")
@ApiModelProperty("参赛单位id")
private Long companyId;
@ApiModelProperty("组别id")
@ -46,14 +46,14 @@ public class ProvinceCompeteDto {
@ApiModel("添加或修改选手")
public static class PlayerInfo{
@ApiModelProperty("选手id")
private Long playerId ;
private Long playerId;
@ApiModelProperty("参赛单位id")
private Long competeId;
@ApiModelProperty("组别id")
private Long groupId;
@ApiModelProperty("选手姓名")
private String playerName;
@ApiModelProperty("性别")
@ApiModelProperty("性别 0女 1男")
private int gender;
@ApiModelProperty("身份证号")
private String idCard;

33
mt/src/main/java/com/ccsens/mt/bean/po/CompeteGroup.java

@ -24,6 +24,12 @@ public class CompeteGroup implements Serializable {
private Byte recStatus;
private Byte sex;
private Byte maxAge;
private Byte minAge;
private static final long serialVersionUID = 1L;
public Long getId() {
@ -106,6 +112,30 @@ public class CompeteGroup implements Serializable {
this.recStatus = recStatus;
}
public Byte getSex() {
return sex;
}
public void setSex(Byte sex) {
this.sex = sex;
}
public Byte getMaxAge() {
return maxAge;
}
public void setMaxAge(Byte maxAge) {
this.maxAge = maxAge;
}
public Byte getMinAge() {
return minAge;
}
public void setMinAge(Byte minAge) {
this.minAge = minAge;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
@ -122,6 +152,9 @@ public class CompeteGroup implements Serializable {
sb.append(", createdAt=").append(createdAt);
sb.append(", updatedAt=").append(updatedAt);
sb.append(", recStatus=").append(recStatus);
sb.append(", sex=").append(sex);
sb.append(", maxAge=").append(maxAge);
sb.append(", minAge=").append(minAge);
sb.append("]");
return sb.toString();
}

180
mt/src/main/java/com/ccsens/mt/bean/po/CompeteGroupExample.java

@ -724,6 +724,186 @@ public class CompeteGroupExample {
addCriterion("rec_status not between", value1, value2, "recStatus");
return (Criteria) this;
}
public Criteria andSexIsNull() {
addCriterion("sex is null");
return (Criteria) this;
}
public Criteria andSexIsNotNull() {
addCriterion("sex is not null");
return (Criteria) this;
}
public Criteria andSexEqualTo(Byte value) {
addCriterion("sex =", value, "sex");
return (Criteria) this;
}
public Criteria andSexNotEqualTo(Byte value) {
addCriterion("sex <>", value, "sex");
return (Criteria) this;
}
public Criteria andSexGreaterThan(Byte value) {
addCriterion("sex >", value, "sex");
return (Criteria) this;
}
public Criteria andSexGreaterThanOrEqualTo(Byte value) {
addCriterion("sex >=", value, "sex");
return (Criteria) this;
}
public Criteria andSexLessThan(Byte value) {
addCriterion("sex <", value, "sex");
return (Criteria) this;
}
public Criteria andSexLessThanOrEqualTo(Byte value) {
addCriterion("sex <=", value, "sex");
return (Criteria) this;
}
public Criteria andSexIn(List<Byte> values) {
addCriterion("sex in", values, "sex");
return (Criteria) this;
}
public Criteria andSexNotIn(List<Byte> values) {
addCriterion("sex not in", values, "sex");
return (Criteria) this;
}
public Criteria andSexBetween(Byte value1, Byte value2) {
addCriterion("sex between", value1, value2, "sex");
return (Criteria) this;
}
public Criteria andSexNotBetween(Byte value1, Byte value2) {
addCriterion("sex not between", value1, value2, "sex");
return (Criteria) this;
}
public Criteria andMaxAgeIsNull() {
addCriterion("max_age is null");
return (Criteria) this;
}
public Criteria andMaxAgeIsNotNull() {
addCriterion("max_age is not null");
return (Criteria) this;
}
public Criteria andMaxAgeEqualTo(Byte value) {
addCriterion("max_age =", value, "maxAge");
return (Criteria) this;
}
public Criteria andMaxAgeNotEqualTo(Byte value) {
addCriterion("max_age <>", value, "maxAge");
return (Criteria) this;
}
public Criteria andMaxAgeGreaterThan(Byte value) {
addCriterion("max_age >", value, "maxAge");
return (Criteria) this;
}
public Criteria andMaxAgeGreaterThanOrEqualTo(Byte value) {
addCriterion("max_age >=", value, "maxAge");
return (Criteria) this;
}
public Criteria andMaxAgeLessThan(Byte value) {
addCriterion("max_age <", value, "maxAge");
return (Criteria) this;
}
public Criteria andMaxAgeLessThanOrEqualTo(Byte value) {
addCriterion("max_age <=", value, "maxAge");
return (Criteria) this;
}
public Criteria andMaxAgeIn(List<Byte> values) {
addCriterion("max_age in", values, "maxAge");
return (Criteria) this;
}
public Criteria andMaxAgeNotIn(List<Byte> values) {
addCriterion("max_age not in", values, "maxAge");
return (Criteria) this;
}
public Criteria andMaxAgeBetween(Byte value1, Byte value2) {
addCriterion("max_age between", value1, value2, "maxAge");
return (Criteria) this;
}
public Criteria andMaxAgeNotBetween(Byte value1, Byte value2) {
addCriterion("max_age not between", value1, value2, "maxAge");
return (Criteria) this;
}
public Criteria andMinAgeIsNull() {
addCriterion("min_age is null");
return (Criteria) this;
}
public Criteria andMinAgeIsNotNull() {
addCriterion("min_age is not null");
return (Criteria) this;
}
public Criteria andMinAgeEqualTo(Byte value) {
addCriterion("min_age =", value, "minAge");
return (Criteria) this;
}
public Criteria andMinAgeNotEqualTo(Byte value) {
addCriterion("min_age <>", value, "minAge");
return (Criteria) this;
}
public Criteria andMinAgeGreaterThan(Byte value) {
addCriterion("min_age >", value, "minAge");
return (Criteria) this;
}
public Criteria andMinAgeGreaterThanOrEqualTo(Byte value) {
addCriterion("min_age >=", value, "minAge");
return (Criteria) this;
}
public Criteria andMinAgeLessThan(Byte value) {
addCriterion("min_age <", value, "minAge");
return (Criteria) this;
}
public Criteria andMinAgeLessThanOrEqualTo(Byte value) {
addCriterion("min_age <=", value, "minAge");
return (Criteria) this;
}
public Criteria andMinAgeIn(List<Byte> values) {
addCriterion("min_age in", values, "minAge");
return (Criteria) this;
}
public Criteria andMinAgeNotIn(List<Byte> values) {
addCriterion("min_age not in", values, "minAge");
return (Criteria) this;
}
public Criteria andMinAgeBetween(Byte value1, Byte value2) {
addCriterion("min_age between", value1, value2, "minAge");
return (Criteria) this;
}
public Criteria andMinAgeNotBetween(Byte value1, Byte value2) {
addCriterion("min_age not between", value1, value2, "minAge");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {

3
mt/src/main/java/com/ccsens/mt/service/FileService.java

@ -6,6 +6,7 @@ import cn.hutool.core.date.DateUtil;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.lang.Snowflake;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ImageUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
@ -139,7 +140,7 @@ public class FileService implements IFileService {
out.close();
if (file.length() > 2097152) {
throw new BaseException(CodeEnum.PHOTO_FILE_EXCEED_2M);
// throw new BaseException(CodeEnum.PHOTO_FILE_EXCEED_2M);
}
String name = file.getName();

53
mt/src/main/java/com/ccsens/mt/service/ProvinceService.java

@ -65,6 +65,8 @@ public class ProvinceService implements IProvinceService {
private CompeteTeamMemberMapper teamMemberMapper;
@Resource
private CompetePlayerMapper competePlayerMapper;
@Resource
private CompeteGroupMapper competeGroupMapper;
/**
* 查找当前用户填写的信息的概览
@ -133,16 +135,26 @@ public class ProvinceService implements IProvinceService {
CompetePlayerExample competePlayerExample = new CompetePlayerExample();
competePlayerExample.createCriteria().andIdCardEqualTo(param.getIdCard());
if(competePlayerDao.countByExample(competePlayerExample) != 0){
throw new BaseException(CodeEnum.WBS_REPEAT_MEMBER_PHONE);
throw new BaseException(CodeEnum.ID_CARD_ALREADY);
}
if(ObjectUtil.isNull(param.getCompeteId())){ throw new BaseException(CodeEnum.NOT_COMPANY); }
if(ObjectUtil.isNull(param.getGroupId())){ throw new BaseException(CodeEnum.MT_NOT_GROUP); }
//检查性别与组别是否匹配
CompeteGroup competeGroup = competeGroupMapper.selectByPrimaryKey(param.getGroupId());
if(ObjectUtil.isNull(competeGroup) || param.getGender() != competeGroup.getSex()){
throw new BaseException(CodeEnum.MT_NOT_GROUP);
}
//判断各种证件是否为空
if(ObjectUtil.isNull(param.getCompeteId())){ throw new BaseException(CodeEnum.PHOTO_IS_EMPTY); }
if(ObjectUtil.isNull(param.getGroupId())){ throw new BaseException(CodeEnum.PHOTO_IS_EMPTY); }
if(ObjectUtil.isNull(param.getIdCardFront())){ throw new BaseException(CodeEnum.PHOTO_IS_EMPTY); }
if(ObjectUtil.isNull(param.getIdPhone())){ throw new BaseException(CodeEnum.PHOTO_IS_EMPTY); }
if(ObjectUtil.isNull(param.getStudentRecord())){ throw new BaseException(CodeEnum.PHOTO_IS_EMPTY); }
if(ObjectUtil.isNull(param.getHealthRecord())){ throw new BaseException(CodeEnum.PHOTO_IS_EMPTY); }
if(ObjectUtil.isNull(param.getInsuranceRecord())){ throw new BaseException(CodeEnum.PHOTO_IS_EMPTY); }
if(ObjectUtil.isNull(param.getIdCardFront()) && ObjectUtil.isNotNull(param.getIdCardBack())){
param.setIdCardFront(param.getIdCardBack());
param.setIdCardBack(null);
}
if(ObjectUtil.isNull(param.getIdCardFront())){ throw new BaseException(CodeEnum.PHOTO_IS_EMPTY.mtMsgPhoto("身份证/户口本信息")); }
if(ObjectUtil.isNull(param.getIdPhone())){ throw new BaseException(CodeEnum.PHOTO_IS_EMPTY.mtMsgPhoto("证件照")); }
if(ObjectUtil.isNull(param.getStudentRecord())){ throw new BaseException(CodeEnum.PHOTO_IS_EMPTY.mtMsgPhoto("学籍证明")); }
if(ObjectUtil.isNull(param.getHealthRecord())){ throw new BaseException(CodeEnum.PHOTO_IS_EMPTY.mtMsgPhoto("健康证明")); }
if(ObjectUtil.isNull(param.getInsuranceRecord())){ throw new BaseException(CodeEnum.PHOTO_IS_EMPTY.mtMsgPhoto("保险证明")); }
player.setIdCard(param.getIdCard());
player.setCompanyId(param.getCompeteId());
player.setCompeteGroupId(param.getGroupId());
@ -239,6 +251,9 @@ public class ProvinceService implements IProvinceService {
return competeCompany;
}
/**
* 新增修改单位信息
*/
@Override
public ProvinceCompeteVo.CompeteCompany changeCompany(CompeteDto.CompeteCompany param, Long userId) {
//判断当前单位id是否为空,
@ -253,8 +268,9 @@ public class ProvinceService implements IProvinceService {
throw new BaseException(CodeEnum.NAME_EMPTY);
}
competeCompany.setName(param.getCompanyName());
if (StrUtil.isEmpty(param.getContactsName())){
throw new BaseException(CodeEnum.NAME_EMPTY);
throw new BaseException(CodeEnum.CONTACTS_NAME_EMPTY);
}
competeCompany.setContactsName(param.getContactsName());
@ -439,6 +455,7 @@ public class ProvinceService implements IProvinceService {
return competePlayerDao.getPlayerByPlayerId(param.getPlayerId());
}
@Override
public void updateLeader(ProvinceCompeteDto.ModifyLeader param) {
if(ObjectUtil.isNull(param.getCoachId())){
@ -446,10 +463,10 @@ public class ProvinceService implements IProvinceService {
competeCoachExample.createCriteria().andCompanyIdEqualTo(param.getCompanyId()).andIdentityEqualTo((byte) param.getIdentity());
long count = competeCoachMapper.countByExample(competeCoachExample);
if (param.getIdentity() == 0 && count >= 2){
throw new BaseException(CodeEnum.COACH_NUM_FULL);
throw new BaseException(CodeEnum.COACH_NUM_FULL);
}
if (param.getIdentity() == 1 && count >=3){
throw new BaseException(CodeEnum.COACH_NUM_FULL);
throw new BaseException(CodeEnum.LEADER_NUM_FULL);
}
//手机号不能为空,且正确
if(StrUtil.isEmpty(param.getPhone()) || !param.getPhone().matches(WebConstant.REGEX_PHONE)){
@ -518,13 +535,13 @@ public class ProvinceService implements IProvinceService {
//查找此公司此组别是否参加过这个项目
int num = competeCompanyDao.getNumByCompanyAndGroup(competeProject.getId(), player.getCompanyId(), player.getCompeteGroupId(), param.getCompeteTimeId());
if (num > 0) {
throw new BaseException(CodeEnum.JOIN_PROJECT_NUM_FULL.mtProjectMsg("该项目该组别"));
throw new BaseException(CodeEnum.JOIN_PROJECT_NUM_FULL.mtProjectMsg1("该项目该组别"));
}
//查找个人参赛数量是否符合
//查找个人参赛数量是否符合(个人比赛3个)
CompeteProjectPlayerExample projectPlayerExample = new CompeteProjectPlayerExample();
projectPlayerExample.createCriteria().andPlayerIdEqualTo(joinPlayer.getPlayerId()).andCompeteTimeIdEqualTo(param.getCompeteTimeId());
if (projectPlayerMapper.countByExample(projectPlayerExample) >= 3) {
throw new BaseException(CodeEnum.JOIN_PROJECT_NUM_FULL.mtProjectMsg(player.getName()));
throw new BaseException(CodeEnum.JOIN_PROJECT_NUM_FULL.mtProjectMsg(player.getName()+"个人"));
}
//参加比赛记录
CompeteProjectPlayer projectPlayer = new CompeteProjectPlayer();
@ -570,7 +587,8 @@ public class ProvinceService implements IProvinceService {
long memberNum = teamMemberMapper.countByExample(example);
if(joinCount + memberNum > competeProject.getMemberMax() ){
throw new BaseException(CodeEnum.TEAM_MEMBER_ERROR);
throw new BaseException(CodeEnum.MEMBER_NUM_ERROR);
//TODO 参赛人数不满足比赛人数要求
}
for (int i = 0; i < param.getPlayers().size(); i++) {
@ -591,10 +609,11 @@ public class ProvinceService implements IProvinceService {
}
//选手这次参加,以前未参加,添加数据
if(joinProjectPlayer.getJoinProject() == 1 && CollectionUtil.isEmpty(teamMemberList)){
//检查该选手报名项目数量
//检查该选手报名项目数量(团队6个)
int a = competeCompanyDao.getTeamNumByPlayerId(param.getCompeteTimeId(),player.getId());
if(a >= 6){
throw new BaseException(CodeEnum.JOIN_PROJECT_NUM_FULL.mtProjectMsg(player.getName()));
throw new BaseException(CodeEnum.JOIN_PROJECT_NUM_FULL.mtProjectMsg(player.getName()+"团队"));
//XXX团队项目参赛次数已满
}
//添加成员表
CompeteTeamMember teamMember = new CompeteTeamMember();

4
mt/src/main/resources/application.yml

@ -1,4 +1,4 @@
spring:
profiles:
active: test
include: common, util-test
active: prod
include: common, util-prod

57
mt/src/main/resources/mapper_raw/CompeteGroupMapper.xml

@ -12,6 +12,9 @@
<result column="created_at" jdbcType="TIMESTAMP" property="createdAt" />
<result column="updated_at" jdbcType="TIMESTAMP" property="updatedAt" />
<result column="rec_status" jdbcType="TINYINT" property="recStatus" />
<result column="sex" jdbcType="TINYINT" property="sex" />
<result column="max_age" jdbcType="TINYINT" property="maxAge" />
<result column="min_age" jdbcType="TINYINT" property="minAge" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
@ -73,7 +76,7 @@
</sql>
<sql id="Base_Column_List">
id, group_name, description, start_age, end_age, sequence, type, created_at, updated_at,
rec_status
rec_status, sex, max_age, min_age
</sql>
<select id="selectByExample" parameterType="com.ccsens.mt.bean.po.CompeteGroupExample" resultMap="BaseResultMap">
select
@ -109,11 +112,13 @@
insert into t_compete_group (id, group_name, description,
start_age, end_age, sequence,
type, created_at, updated_at,
rec_status)
rec_status, sex, max_age,
min_age)
values (#{id,jdbcType=BIGINT}, #{groupName,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR},
#{startAge,jdbcType=INTEGER}, #{endAge,jdbcType=INTEGER}, #{sequence,jdbcType=INTEGER},
#{type,jdbcType=TINYINT}, #{createdAt,jdbcType=TIMESTAMP}, #{updatedAt,jdbcType=TIMESTAMP},
#{recStatus,jdbcType=TINYINT})
#{recStatus,jdbcType=TINYINT}, #{sex,jdbcType=TINYINT}, #{maxAge,jdbcType=TINYINT},
#{minAge,jdbcType=TINYINT})
</insert>
<insert id="insertSelective" parameterType="com.ccsens.mt.bean.po.CompeteGroup">
insert into t_compete_group
@ -148,6 +153,15 @@
<if test="recStatus != null">
rec_status,
</if>
<if test="sex != null">
sex,
</if>
<if test="maxAge != null">
max_age,
</if>
<if test="minAge != null">
min_age,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
@ -180,6 +194,15 @@
<if test="recStatus != null">
#{recStatus,jdbcType=TINYINT},
</if>
<if test="sex != null">
#{sex,jdbcType=TINYINT},
</if>
<if test="maxAge != null">
#{maxAge,jdbcType=TINYINT},
</if>
<if test="minAge != null">
#{minAge,jdbcType=TINYINT},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.ccsens.mt.bean.po.CompeteGroupExample" resultType="java.lang.Long">
@ -221,6 +244,15 @@
<if test="record.recStatus != null">
rec_status = #{record.recStatus,jdbcType=TINYINT},
</if>
<if test="record.sex != null">
sex = #{record.sex,jdbcType=TINYINT},
</if>
<if test="record.maxAge != null">
max_age = #{record.maxAge,jdbcType=TINYINT},
</if>
<if test="record.minAge != null">
min_age = #{record.minAge,jdbcType=TINYINT},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
@ -237,7 +269,10 @@
type = #{record.type,jdbcType=TINYINT},
created_at = #{record.createdAt,jdbcType=TIMESTAMP},
updated_at = #{record.updatedAt,jdbcType=TIMESTAMP},
rec_status = #{record.recStatus,jdbcType=TINYINT}
rec_status = #{record.recStatus,jdbcType=TINYINT},
sex = #{record.sex,jdbcType=TINYINT},
max_age = #{record.maxAge,jdbcType=TINYINT},
min_age = #{record.minAge,jdbcType=TINYINT}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
@ -272,6 +307,15 @@
<if test="recStatus != null">
rec_status = #{recStatus,jdbcType=TINYINT},
</if>
<if test="sex != null">
sex = #{sex,jdbcType=TINYINT},
</if>
<if test="maxAge != null">
max_age = #{maxAge,jdbcType=TINYINT},
</if>
<if test="minAge != null">
min_age = #{minAge,jdbcType=TINYINT},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
@ -285,7 +329,10 @@
type = #{type,jdbcType=TINYINT},
created_at = #{createdAt,jdbcType=TIMESTAMP},
updated_at = #{updatedAt,jdbcType=TIMESTAMP},
rec_status = #{recStatus,jdbcType=TINYINT}
rec_status = #{recStatus,jdbcType=TINYINT},
sex = #{sex,jdbcType=TINYINT},
max_age = #{maxAge,jdbcType=TINYINT},
min_age = #{minAge,jdbcType=TINYINT}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>

BIN
nullzzz/2020-10-22/1603333027707.xlsx

Binary file not shown.

20
tall/src/main/java/com/ccsens/tall/web/UserController.java

@ -163,22 +163,22 @@ public class UserController {
@ApiImplicitParams({
})
@RequestMapping(value = "/account", method = RequestMethod.GET, produces = {"application/json;charset=UTF-8"})
public JsonResponse accounts(@ApiParam @RequestParam String account) throws Exception {
public JsonResponse<Boolean> accounts(@ApiParam @RequestParam String account) throws Exception {
Boolean flag = userService.findAccount(account);
return JsonResponse.newInstance().ok(flag);
}
// @ApiOperation(value = "/检查手机号是否被注册", notes = "")
// @ApiImplicitParams({
// })
// @RequestMapping(value = "/phone", method = RequestMethod.GET, produces = {"application/json;charset=UTF-8"})
// public JsonResponse findPhone(@ApiParam @RequestParam String phone) throws Exception {
//
// Boolean flag = userService.findPhone(phone);
// return JsonResponse.newInstance().ok(flag);
// }
@ApiOperation(value = "/检查手机号是否被注册", notes = "")
@ApiImplicitParams({
})
@RequestMapping(value = "/phone", method = RequestMethod.GET, produces = {"application/json;charset=UTF-8"})
public JsonResponse<Boolean> findPhone(@ApiParam @RequestParam String phone) throws Exception {
Boolean flag = userService.findPhone(phone);
return JsonResponse.newInstance().ok(flag);
}
// @ApiOperation(value = "/修改账号信息",notes = "")
// @ApiImplicitParams({

7
tall/src/main/java/com/ccsens/tall/web/UserInfoController.java

@ -14,10 +14,7 @@ import io.jsonwebtoken.Claims;
import io.swagger.annotations.*;
import org.apache.commons.io.FileUtils;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
@ -65,7 +62,7 @@ public class UserInfoController {
})
@RequestMapping(value = "/avatarUrl", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
public JsonResponse uploadAvatarUrl(HttpServletRequest request,
@ApiParam @Validated @RequestBody Part file) throws Exception {
@RequestParam(required = true) Part file) throws Exception {
Long currentUserId = Long.valueOf(((Claims) request.getAttribute(WebConstant.REQUEST_KEY_CLAIMS)).getSubject());
userInfoService.uploadAvatarUrl(currentUserId,file);

4
tall/src/main/resources/application.yml

@ -1,5 +1,5 @@
spring:
profiles:
active: dev
include: util-dev,common
active: test
include: util-test,common

28
util/src/main/java/com/ccsens/util/CodeEnum.java

@ -161,18 +161,34 @@ public enum CodeEnum {
DINGDING_EXCEPTION(132,"钉钉接口调用异常。",true),
URL_ERROR(133, "请求路径转换异常", true),
JOIN_PROJECT_NUM_FULL(134, "可参赛次数已满", true),
PHOTO_FILE_EXCEED_2M(135, "图片大小不能超过2M", true),
COACH_NUM_FULL(136,"该单位领队或教练人数已达上限",true),
AUTHORIZATION_AGREE(137,"请阅读并同意比赛协议",true),
NAME_EMPTY(138,"名称不能为空",true),
PHOTO_IS_EMPTY(139,"证件不能为空",true),
COACH_NUM_FULL(136,"教练人数已达上限",true),
LEADER_NUM_FULL(137,"领队人数已达上限",true),
AUTHORIZATION_AGREE(138,"请阅读并同意安全责任书",true),
NAME_EMPTY(139,"单位名称不能为空",true),
PHOTO_IS_EMPTY(140,"请上传证件照",true),
ID_CARD_ALREADY(141,"此身份证已注册",true),
NOT_COMPANY(142,"请先填写基础信息",true),
MT_NOT_GROUP(143,"请选择正确的组别信息",true),
CONTACTS_NAME_EMPTY(144,"联系人名称不能为空",true),
MEMBER_NUM_ERROR(144,"参赛人数不满足比赛人数要求",true),
;
public CodeEnum mtMsgPhoto(String msg){
this.msg = "请上传"+msg;
return this;
}
public CodeEnum mtProjectMsg(String msg){
this.msg = msg+"可参赛次数已满";
this.msg = msg+"项目参赛次数已满";
return this;
}
public CodeEnum mtProjectMsg1(String msg){
this.msg = msg+"报名人数已满";
return this;
}
public CodeEnum addMsg(String msg){

13
util/src/test/java/com/ccsens/util/OtherTest.java

@ -1,12 +1,14 @@
package com.ccsens.util;
import cn.hutool.core.util.ImageUtil;
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
import javax.script.ScriptException;
import java.io.File;
@Slf4j
public class OtherTest {
@ -24,4 +26,15 @@ public class OtherTest {
}
}
@Test
public void test3() {
File file = new File("C:\\Users\\逗\\Desktop\\ABDBBE53630FE09D526858C4A8029873.jpg");
File file1 = new File("C:\\Users\\逗\\Desktop\\1.jpg");
File file2 = new File("C:\\Users\\逗\\Desktop\\2.jpg");
System.out.println(file.length());
ImageUtil.scale(file,file1,0.5f);
System.out.println(file1);
ImageUtil.scale(file1,file2,2);
}
}

Loading…
Cancel
Save