提交 e12bed6a 作者: zhenjie

Merge branch 'develop'

......@@ -27,6 +27,7 @@
<dependency>
<groupId>org.hibernate.validator</groupId>
<artifactId>hibernate-validator</artifactId>
<version>6.0.7.Final</version>
</dependency>
<dependency>
<groupId>cn.afterturn</groupId>
......@@ -38,4 +39,4 @@
<version>1.5.22</version>
</dependency>
</dependencies>
</project>
\ No newline at end of file
</project>
......@@ -7,10 +7,12 @@ import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.util.Date;
import java.util.List;
/**
......@@ -45,37 +47,53 @@ public class LicenseOrganizationsDTO {
@Size(max = 25, message = "机构名称不能超过25个字符")
private String name;
@ApiModelProperty(name = "机构地区", example = "110000,110100")
@ApiModelProperty(value = "机构地区", example = "110000,110100")
@NotBlank(message = "机构地区不能为空", groups = {Create.class, Update.class})
private String region;
@ApiModelProperty(name = "机构地区名称", example = "河北省,石家庄市", required = true)
@ApiModelProperty(value = "机构地区名称", example = "河北省,石家庄市", required = true)
@NotBlank(message = "机构地区名称", groups = {Create.class, Update.class})
private String regionName;
@ApiModelProperty(name = "机构详细地址", example = "南山区")
@ApiModelProperty(value = "机构详细地址", example = "南山区")
@NotBlank(message = "机构详细地址不能为空", groups = {Create.class, Update.class})
private String detailedAddress;
@ApiModelProperty(name = "是否是考点机构 0否 1是", example = "0", required = true)
@ApiModelProperty(value = "是否是考点机构 0否 1是", example = "0", required = true)
@NotNull(message = "考点机构不能为空", groups = {Create.class, Update.class})
private Integer testCenter;
@ApiModelProperty(name = "机构规模id不能为空 ", example = "1")
@ApiModelProperty(value = "机构规模id不能为空 ", example = "1")
//@NotNull(message = "机构规模id不能为空", groups = {Create.class, Update.class})
private Integer scaleId;
@ApiModelProperty(name = "机构规模名称", example = "1")
@ApiModelProperty(value = "机构规模名称", example = "1")
private String scaleName;
@ApiModelProperty(name = "机构描述", example = "机构描述0001")
@ApiModelProperty(value = "机构描述", example = "机构描述0001")
//@NotNull(message = "机构描述", groups = {Create.class, Update.class})
private String description;
@ApiModelProperty(name = "机构详情", example = "机构详情0001")
@ApiModelProperty(value = "机构详情", example = "机构详情0001")
//@NotNull(message = "机构描述", groups = {Create.class, Update.class})
private String detail;
@ApiModelProperty(name = "培训项目", required = false)
@ApiModelProperty(value = "培训项目", required = false)
private List<LicenseTrainingProgramsDTO> programsDOList;
@ApiModelProperty(value = "经度", example = "40.892313123", required = true)
private Double longitude;
@ApiModelProperty(value = "纬度", example = "50.892313123", required = true)
private Double latitude;
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建时间", example = "2023-07-14", required = true)
private Date createTime;
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "更新时间", example = "2023-07-14", required = true)
private Date updateTime;
}
......@@ -11,6 +11,7 @@ import lombok.NoArgsConstructor;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.math.BigDecimal;
/**
* @Author small
......@@ -54,7 +55,7 @@ public class LicenseTrainingProgramsDTO {
@ApiModelProperty(value = "培训价格", example = "1000", required = true)
@NotNull(message = "培训价格不能为空", groups = {Create.class, Update.class})
@Size(min = 0, max = 100000, message = "价格不能超过100000")
private Integer price;
private BigDecimal price;
@ApiModelProperty(value = "培训地点不能为空", example = "广东省深圳市南山区XXX001", required = true)
@NotBlank(message = "培训地点不能为空", groups = {Create.class, Update.class})
......
......@@ -35,7 +35,7 @@ public class LicenseOrganizationsQO {
private Integer typeId;
@ApiModelProperty(value = "开始时间,如果只有一个日期,就开始时间与结束时间一致", example = "2023-07-14", required = false)
private String statTime;
private String startTime;
@ApiModelProperty(value = "结束时间", example = "2023-07-14", required = false)
private String endTime;
......
package com.mmc.csf.licence.vo;
import com.mmc.csf.release.model.group.Create;
import com.mmc.csf.release.model.group.Page;
import com.mmc.csf.release.model.group.Update;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.Value;
import org.springframework.validation.annotation.Validated;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.validation.Valid;
import javax.validation.constraints.*;
import java.util.List;
/**
......@@ -27,7 +29,7 @@ public class LicenseOrganizationsVO {
private String mainImage;
@ApiModelProperty(value = "机构副图不能为空", example = "http://", required = true)
@NotBlank(message = "机构副图不能为空", groups = {Create.class, Update.class})
//@NotBlank(message = "机构副图不能为空", groups = {Create.class, Update.class})
private String auxiliaryPicture;
@ApiModelProperty(value = "机构视频", example = "http://")
......@@ -38,37 +40,46 @@ public class LicenseOrganizationsVO {
@Size(max = 25, message = "机构名称不能超过25个字符")
private String name;
@ApiModelProperty(name = "机构地区编号", example = "110000,130100", required = true)
@ApiModelProperty(value = "机构地区编号", example = "110000,130100", required = true)
@NotBlank(message = "机构地区不能为空", groups = {Create.class, Update.class})
private String region;
@ApiModelProperty(name = "机构地区名称", example = "河北省,石家庄市", required = true)
@NotBlank(message = "机构地区名称", groups = {Create.class, Update.class})
@ApiModelProperty(value = "机构地区名称", example = "河北省,石家庄市", required = false)
//@NotBlank(message = "机构地区名称", groups = {Create.class, Update.class})
private String regionName;
@ApiModelProperty(name = "机构详细地址", example = "南山区", required = true)
@NotBlank(message = "机构详细地址不能为空", groups = {Create.class, Update.class})
@ApiModelProperty(value = "经度", example = "40.892313123", required = true)
private Double longitude;
@ApiModelProperty(value = "纬度", example = "50.892313123", required = true)
private Double latitude;
@ApiModelProperty(value = "机构详细地址", example = "南山区", required = false)
//@NotBlank(message = "机构详细地址不能为空", groups = {Create.class, Update.class})
private String detailedAddress;
@ApiModelProperty(name = "是否是考点机构 0否 1是", example = "0", required = true)
@ApiModelProperty(value = "是否是考点机构 0否 1是", example = "0", required = true)
@NotNull(message = "考点机构不能为空 0否 1是", groups = {Create.class, Update.class})
private Integer testCenter;
@ApiModelProperty(name = "机构规模id不能为空", example = "1")
@ApiModelProperty(value = "机构规模id不能为空", example = "1")
//@NotNull(message = "机构规模id不能为空", groups = {Create.class, Update.class})
// @Size(max = 4, message = "机构规模id不能超过4", groups = {Create.class, Update.class})
@Max(value = 4, groups = {Create.class, Update.class},message = "机构规模id不能超过4")
private Integer scaleId;
@ApiModelProperty(name = "机构描述", example = "机构描述0001")
@ApiModelProperty(value = "机构描述", example = "机构描述0001")
//@NotNull(message = "机构描述", groups = {Create.class, Update.class})
private String description;
@ApiModelProperty(name = "机构详情", example = "机构详情0001", required = true)
@ApiModelProperty(value = "机构详情", example = "机构详情0001", required = true)
@NotNull(message = "机构详情", groups = {Create.class, Update.class})
private String detail;
@ApiModelProperty(name = "培训项目", required = true)
@NotNull(message = "培训项目", groups = {Create.class, Update.class})
@ApiModelProperty(value = "培训项目", required = true)
@NotNull(message = "培训项目不能为空", groups = {Create.class, Update.class})
@Valid
private List<LicenseTrainingProgramsVO> trainingProgramsVOS;
......
......@@ -6,8 +6,10 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Range;
import javax.validation.constraints.Max;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.Objects;
/**
......@@ -20,28 +22,31 @@ public class LicenseTrainingProgramsVO {
private static final long serialVersionUID = -5814724843819090363L;
@ApiModelProperty(value = "培训id", example = "1")
@NotNull(message = "培训id不能为空", groups = Update.class)
// @NotNull(message = "培训id不能为空", groups = Update.class)
private Integer id;
@ApiModelProperty(value = "培训等级id", example = "1", required = true)
@NotNull(message = "培训等级id不能为空", groups = {Create.class, Update.class})
@Max(value = 3, groups = {Create.class, Update.class},message = "培训等级id不能超过3")
private Integer gradeId;
@ApiModelProperty(value = "培训机型id", example = "1", required = true)
@NotNull(message = "培训机型id不能为空", groups = {Create.class, Update.class})
@Max(value = 4, groups = {Create.class, Update.class},message = "培训机型id不能超过4")
private Integer modelsId;
@ApiModelProperty(value = "培训类型id", example = "1", required = true)
@NotNull(message = "培训类型id不能为空", groups = {Create.class, Update.class})
@Max(value = 2, groups = {Create.class, Update.class},message = "培训类型id不能超过2")
private Integer typeId;
@ApiModelProperty(value = "培训价格", example = "1000", required = true)
@NotNull(message = "培训价格不能为空", groups = {Create.class, Update.class})
@Range(min = 0, max = 100000, message = "价格不能超过100000")
private Integer price;
private BigDecimal price;
@ApiModelProperty(value = "培训地点不能为空", example = "广东省深圳市南山区XXX001", required = true)
@NotBlank(message = "培训地点不能为空", groups = {Create.class, Update.class})
//@ApiModelProperty(value = "培训地点不能为空", example = "广东省深圳市南山区XXX001", required = true)
//@NotBlank(message = "培训地点不能为空", groups = {Create.class, Update.class})
private String place;
@ApiModelProperty(value = "培训主图不能为空", example = "http://", required = true)
......
......@@ -404,7 +404,7 @@ public enum ResultEnum implements BaseErrorInfoInterface {
// 论坛
DYNAMIC_SENSITIVE_INFO("50100", "发布信息涉及敏感信息!"),
THE_ORGANIZATION_NAME_ALREADY_EXISTS("60001", "机构名称已存在"),
THREE_FIELDS_CAN_BE_REPEATED("60002", "机型、等级、价格存在重复");
THREE_FIELDS_CAN_BE_REPEATED("60002", "机型、等级、类型存在重复");
/**
* 错误码
*
......
......@@ -19,9 +19,9 @@ spec:
- name: ims
image: REGISTRY/NAMESPACE/IMAGE:TAG
readinessProbe:
initialDelaySeconds: 480
periodSeconds: 10
failureThreshold: 20
initialDelaySeconds: 15
periodSeconds: 5
failureThreshold: 10
httpGet:
path: /release/actuator/health/readiness
port: ims-port
......@@ -31,9 +31,7 @@ spec:
- name: localtime
mountPath: /etc/localtime
readOnly: true
resources:
limits:
cpu: 100m
resources: { }
ports:
- containerPort: 10001
name: ims-port
......
......@@ -18,4 +18,4 @@ patches:
images:
- name: REGISTRY/NAMESPACE/IMAGE:TAG
newName: mmc-registry.cn-shenzhen.cr.aliyuncs.com/sharefly-dev/ims
newTag: 533f6e1055f6df81c13c487255ce13cff5add01d
newTag: 8741c5ccb039f019178fcca3aa909112dae7fafe
......@@ -19,27 +19,18 @@ public interface LicenceBackgroundDao {
void insertOrganizations(LicenseOrganizationsDO organizationsDO);
void insertLicenseOrgTraining(List<Integer> orgTrainingIds, Integer orgId);
int countId(LicenseOrganizationsDO organizationsDO);
void removeOrgAndTraining(Integer id);
void updateOrganizations(LicenseOrganizationsDO organizationsDO);
void removeOrganizations(Integer id);
void removeOrgTraining(Integer id);
int countPro(Integer modelsId, Integer gradeId, Integer typeId, Integer id);
void insertProject(LicenseTrainingProgramsDO programsDO);
void updateProject(LicenseTrainingProgramsDO programsDO);
void removeProject(Integer id);
List<LicenseProgramsDO> LicenseTrainingProgramsDTO(Integer id);
int countListOrgPage(LicenseOrganizationsQO organizationsQO);
......@@ -49,4 +40,6 @@ public interface LicenceBackgroundDao {
List<LicenseProgramsDO> trainingProgram(LicenseOrganizationsQO organizationsQO);
int removeOrg(Integer id);
List<String> getOrgName(List<Integer> orgCode);
}
......@@ -9,9 +9,11 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.Date;
import java.util.List;
/**
......@@ -77,6 +79,20 @@ public class LicenseOrganizationsDO {
private List<LicenseTrainingProgramsDTO> programsDOList;
@ApiModelProperty(value = "经度", example = "40.892313123", required = true)
private Double longitude;
@ApiModelProperty(value = "纬度", example = "50.892313123", required = true)
private Double latitude;
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建时间", example = "2023-07-14", required = true)
private Date createTime;
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "更新时间", example = "2023-07-14", required = true)
private Date updateTime;
/**
* VO类转换
*/
......@@ -93,6 +109,8 @@ public class LicenseOrganizationsDO {
this.detail = organizationsVO.getDetail();
this.detailedAddress = organizationsVO.getDetailedAddress();
this.regionName = organizationsVO.getRegionName();
this.longitude = organizationsVO.getLongitude();
this.latitude = organizationsVO.getLatitude();
}
......@@ -117,6 +135,10 @@ public class LicenseOrganizationsDO {
.detail(this.detail)
.programsDOList(this.programsDOList)
.regionName(this.regionName)
.longitude(this.longitude)
.latitude(this.latitude)
.createTime(this.createTime)
.updateTime(this.updateTime)
.build();
}
}
......@@ -12,6 +12,7 @@ import lombok.NoArgsConstructor;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.math.BigDecimal;
/**
* @Author small
......@@ -55,7 +56,7 @@ public class LicenseProgramsDO {
@ApiModelProperty(value = "培训价格", example = "1000", required = true)
@NotNull(message = "培训价格不能为空", groups = {Create.class, Update.class})
@Size(min = 0, max = 100000, message = "价格不能超过100000")
private Integer price;
private BigDecimal price;
@ApiModelProperty(value = "培训地点不能为空", example = "广东省深圳市南山区XXX001", required = true)
@NotBlank(message = "培训地点不能为空", groups = {Create.class, Update.class})
......
......@@ -10,6 +10,7 @@ import lombok.NoArgsConstructor;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
/**
* @Author small
......@@ -40,16 +41,19 @@ public class LicenseTrainingProgramsDO {
@ApiModelProperty(value = "培训价格", example = "1000", required = true)
@NotNull(message = "培训价格不能为空", groups = {Create.class, Update.class})
private Integer price;
private BigDecimal price;
@ApiModelProperty(value = "培训地点不能为空", example = "1", required = true)
@NotBlank(message = "培训地点不能为空", groups = {Create.class, Update.class})
// @ApiModelProperty(value = "培训地点不能为空", example = "1", required = true)
//@NotBlank(message = "培训地点不能为空", groups = {Create.class, Update.class})
private String place;
@ApiModelProperty(value = "培训主图不能为空", example = "1", required = true)
@NotBlank(message = "培训主图不能为空", groups = {Create.class, Update.class})
private String mainImage;
@ApiModelProperty(value = "机构id", example = "1", required = true)
private Integer orgId;
/**
* VO类转换
......
package com.mmc.csf.release.error;
import com.mmc.csf.common.util.web.BizException;
import com.mmc.csf.common.util.web.ResultBody;
import com.mmc.csf.common.util.web.ResultEnum;
import org.springframework.context.support.DefaultMessageSourceResolvable;
import org.springframework.validation.BindException;
import org.springframework.validation.ObjectError;
import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.MissingPathVariableException;
import org.springframework.web.bind.MissingServletRequestParameterException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.validation.ConstraintViolation;
import javax.validation.ConstraintViolationException;
import java.util.List;
import java.util.stream.Collectors;
/**
* @author 作者 geDuo
* @version 创建时间:2021年8月27日 上午10:15:30
* @explain 类说明
*/
@ControllerAdvice
public class GlobalExceptionHandler {
/**
* 统一处理参数校验错误异常(非Spring接口数据绑定验证)
*
* @param e
* @return
*/
@ExceptionHandler(BindException.class)
@ResponseBody
public ResultBody processValidException(BindException e) {
// 获取校验错误结果信息,并将信息组装
List<String> errorStringList = e.getBindingResult().getAllErrors().stream().map(ObjectError::getDefaultMessage)
.collect(Collectors.toList());
String errorMessage = String.join("; ", errorStringList);
return ResultBody.error(ResultEnum.BODY_NOT_MATCH.getResultCode(), errorMessage);
}
/**
* 统一处理参数校验错误异常
*
* @param e
* @return
*/
@ExceptionHandler(IllegalArgumentException.class)
@ResponseBody
public ResultBody processValidException(IllegalArgumentException e) {
String errorMessage = String.join("; ", e.getMessage());
return ResultBody.error(ResultEnum.BODY_NOT_MATCH.getResultCode(), errorMessage);
}
@ExceptionHandler(ConstraintViolationException.class)
@ResponseBody
public ResultBody processValidException(ConstraintViolationException e) {
String errorMessage = e.getConstraintViolations().stream().map(ConstraintViolation::getMessage)
.collect(Collectors.joining(","));
return ResultBody.error(ResultEnum.BODY_NOT_MATCH.getResultCode(), errorMessage);
}
@ExceptionHandler(MethodArgumentNotValidException.class)
@ResponseBody
public ResultBody processValidException(MethodArgumentNotValidException e) {
String errorMessage = e.getBindingResult().getAllErrors().stream()
.map(DefaultMessageSourceResolvable::getDefaultMessage).collect(Collectors.joining(","));
return ResultBody.error(ResultEnum.BODY_NOT_MATCH.getResultCode(), errorMessage);
}
@ExceptionHandler(MissingServletRequestParameterException.class)
@ResponseBody
public ResultBody processValidException(MissingServletRequestParameterException e) {
String errorMessage = e.getParameterName() + " 不能为空";
return ResultBody.error(ResultEnum.BODY_NOT_MATCH.getResultCode(), errorMessage);
}
@ExceptionHandler(MissingPathVariableException.class)
@ResponseBody
public ResultBody processValidException(MissingPathVariableException e) {
String errorMessage = e.getVariableName() + " 不能为空";
return ResultBody.error(ResultEnum.BODY_NOT_MATCH.getResultCode(), errorMessage);
}
@ExceptionHandler(BizException.class)
@ResponseBody
public ResultBody processValidException(BizException e) {
return ResultBody.error(e.getErrorCode(), e.getErrorMsg());
}
}
......@@ -15,10 +15,12 @@ import com.mmc.csf.release.entity.licence.LicenseProgramsDO;
import com.mmc.csf.release.entity.licence.LicenseTrainingProgramsDO;
import com.mmc.csf.release.service.licence.LicenceBackgroundService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.stream.Collectors;
......@@ -41,27 +43,31 @@ public class LicenceBackgroundServiceImpl implements LicenceBackgroundService {
if (count > 0) {
return ResultBody.error(ResultEnum.THE_ORGANIZATION_NAME_ALREADY_EXISTS);
}
getOrgName(organizations);
LicenseOrganizationsDO organizationsDO = new LicenseOrganizationsDO(organizations);
List<Integer> list = new ArrayList<>();
LicenseTrainingProgramsDO programsDO = null;
if (organizations.getTrainingProgramsVOS() != null && organizations.getTrainingProgramsVOS().size() != 0) {
HashMap<LicenseTrainingProgramsVO, Integer> hashMap = new HashMap<>();
licenceBackgroundDao.insertOrganizations(organizationsDO);
for (LicenseTrainingProgramsVO trainingProgramsVO : organizations.getTrainingProgramsVOS()) {
Integer pro = hashMap.get(trainingProgramsVO);
if (pro == null) {
hashMap.put(trainingProgramsVO, 1);
programsDO = new LicenseTrainingProgramsDO(trainingProgramsVO);
Integer id = organizationsDO.getId();
programsDO.setOrgId(id);
licenceBackgroundDao.insertProject(programsDO);
list.add(programsDO.getId());
organizationsDO.setOrgTrainingIds(list);
} else {
licenceBackgroundDao.removeProject(programsDO.getId());
licenceBackgroundDao.removeOrg(organizationsDO.getId());
hashMap.put(trainingProgramsVO, pro++);
return ResultBody.error(ResultEnum.THREE_FIELDS_CAN_BE_REPEATED);
}
}
licenceBackgroundDao.insertOrganizations(organizationsDO);
licenceBackgroundDao.insertLicenseOrgTraining(organizationsDO.getOrgTrainingIds(), organizationsDO.getId());
// licenceBackgroundDao.insertLicenseOrgTraining(organizationsDO.getOrgTrainingIds(), organizationsDO.getId());
}
return ResultBody.success();
}
......@@ -73,6 +79,8 @@ public class LicenceBackgroundServiceImpl implements LicenceBackgroundService {
if (count > 0) {
return ResultBody.error(ResultEnum.THE_ORGANIZATION_NAME_ALREADY_EXISTS);
}
getOrgName(organizations);
licenceBackgroundDao.removeOrgAndTraining(organizations.getId());
LicenseTrainingProgramsDO programsDO = null;
List<Integer> list = new ArrayList<>();
......@@ -86,23 +94,34 @@ public class LicenceBackgroundServiceImpl implements LicenceBackgroundService {
hashMap.put(trainingProgramsVO, pro++);
return ResultBody.error(ResultEnum.THREE_FIELDS_CAN_BE_REPEATED);
}
licenceBackgroundDao.removeOrganizations(organizations.getId());
// licenceBackgroundDao.removeOrganizations(organizations.getId());
programsDO = new LicenseTrainingProgramsDO(trainingProgramsVO);
Integer id = organizations.getId();
programsDO.setOrgId(id);
licenceBackgroundDao.insertProject(programsDO);
list.add(programsDO.getId());
organizationsDO.setOrgTrainingIds(list);
}
licenceBackgroundDao.updateOrganizations(organizationsDO);
licenceBackgroundDao.insertLicenseOrgTraining(organizationsDO.getOrgTrainingIds(), organizationsDO.getId());
// licenceBackgroundDao.insertLicenseOrgTraining(organizationsDO.getOrgTrainingIds(), organizationsDO.getId());
}
return ResultBody.success();
}
private void getOrgName(LicenseOrganizationsVO organizations) {
String region = organizations.getRegion();
List<String> strings = Arrays.asList(region.split(","));
List<Integer> collect = strings.stream().map(Integer::valueOf).collect(Collectors.toList());
List<String> orgName = licenceBackgroundDao.getOrgName(collect);
String join = StringUtils.join(orgName, ",");
organizations.setRegionName(join);
}
@Override
public ResultBody removeOrganizations(Integer id) {
licenceBackgroundDao.removeOrg(id);
licenceBackgroundDao.removeOrganizations(id);
licenceBackgroundDao.removeOrgAndTraining(id);
return ResultBody.success();
}
......@@ -114,7 +133,6 @@ public class LicenceBackgroundServiceImpl implements LicenceBackgroundService {
}
Integer pageNo = organizationsQO.getPageNo();
organizationsQO.buildCurrentPage();
List<LicenseOrganizationsDO> licenseOrganizationsDOS = licenceBackgroundDao.listOrgPage(organizationsQO);
List<LicenseOrganizationsDTO> orgList = licenseOrganizationsDOS.stream().map(t -> t.organizationsDTO()).collect(Collectors.toList());
//培训项目数据
......@@ -135,10 +153,11 @@ public class LicenceBackgroundServiceImpl implements LicenceBackgroundService {
}
return true;
}).collect(Collectors.toList());
if (collect.size() == 0) {
count = 0;
}
return PageResult.buildPage(pageNo, organizationsQO.getPageSize(), count, collect);
List<LicenseOrganizationsDTO> subList = collect.stream().skip((pageNo - 1) * organizationsQO.getPageSize()).limit(organizationsQO.getPageSize()).
collect(Collectors.toList());
return PageResult.buildPage(pageNo, organizationsQO.getPageSize(), collect.size(), subList);
}
......
......@@ -110,6 +110,16 @@ iuav:
pmsapp:
url: http://127.0.0.1:8099
wx:
sub:
appid: wx5c6a105a0ddca4c5
secret: 96c75255dd26f82f8d55e15b59e101c7
app:
id: wx18b7883acd204278
secret: 28afe74ba373830237a8133a7431ee82
miniprogram-state: trial
env-version: trial
##feign
#feign:
# client:
......
......@@ -19,20 +19,14 @@
insert into license_organizations(main_image, auxiliary_picture, video, `name`, region, region_name,
detailed_address,
test_center, scale_id,
description, detail, create_time, update_time)
description, detail, create_time, update_time, longitude, latitude)
values (#{mainImage}, #{auxiliaryPicture}, #{video}, #{name}, #{region}, #{regionName}, #{detailedAddress},
#{testCenter},
#{scaleId},
#{description}, #{detail}, NOW(), NOW())
#{description}, #{detail}, NOW(), NOW(), #{longitude}, #{latitude})
</insert>
<insert id="insertLicenseOrgTraining">
insert into license_org_training(training_programs_id,organizations_id) values
<foreach item="list" index="index" collection="orgTrainingIds"
separator=",">
(#{list},#{orgId})
</foreach>
</insert>
<select id="countId" resultType="java.lang.Integer">
select count(*)
......@@ -47,15 +41,9 @@
</select>
<delete id="removeOrgAndTraining" parameterType="java.lang.Integer">
DELETE
license_org_training,
license_training_programs
FROM
license_org_training
LEFT JOIN license_training_programs ON license_org_training.training_programs_id = license_training_programs.id
WHERE
license_org_training.organizations_id =
#{id}
delete
from license_training_programs
where org_id = #{id}
</delete>
<update id="updateOrganizations" parameterType="com.mmc.csf.release.entity.licence.LicenseOrganizationsDO">
......@@ -94,58 +82,29 @@
<if test=" detail != null and detail != '' ">
detail = #{detail},
</if>
<if test=" longitude != null and longitude != '' ">
longitude = #{longitude},
</if>
<if test=" latitude != null and latitude != '' ">
latitude = #{latitude},
</if>
update_time=NOW()
</set>
where id = #{id}
</update>
<delete id="removeOrganizations" parameterType="java.lang.Integer">
DELETE
license_org_training,
license_training_programs
FROM
license_org_training
LEFT JOIN license_training_programs ON license_org_training.training_programs_id = license_training_programs.id
WHERE
license_org_training.organizations_id =
#{id}
</delete>
<delete id="removeOrgTraining" parameterType="java.lang.Integer">
delete
from license_org_training
where organizations_id = #{id}
</delete>
<select id="countPro" resultType="java.lang.Integer">
SELECT
count(*)
FROM
license_training_programs ltp
LEFT JOIN license_org_training lot ON ltp.id = lot.training_programs_id
LEFT JOIN license_organizations lo ON lo.id = lot.organizations_id
WHERE
1 =1
<if test=" modelsId != null and modelsId != '' ">
and ltp.models_id = #{modelsId}
</if>
<if test=" gradeId != null and gradeId != '' ">
and ltp.grade_id = #{gradeId}
</if>
<if test=" typeId != null and typeId != '' ">
and ltp.type_id = #{typeId}
</if>
<if test=" id != null and id != '' ">
and lot.organizations_id = #{id}
</if>
</select>
<insert id="insertProject" useGeneratedKeys="true" keyProperty="id"
parameterType="com.mmc.csf.release.entity.licence.LicenseOrganizationsDO">
insert into license_training_programs(grade_id, models_id, type_id, price, place, main_image, create_time,
update_time)
values (#{gradeId}, #{modelsId}, #{typeId}, #{price}, #{place}, #{mainImage}, NOW(), NOW())
update_time,org_id)
values (#{gradeId}, #{modelsId}, #{typeId}, #{price}, #{place}, #{mainImage}, NOW(), NOW(),#{orgId})
</insert>
<update id="updateProject" parameterType="com.mmc.csf.release.entity.licence.LicenseTrainingProgramsDO">
......@@ -186,23 +145,12 @@
where id = #{id}
</delete>
<select id="LicenseTrainingProgramsDTO" resultType="com.mmc.csf.release.entity.licence.LicenseProgramsDO">
SELECT ltp.id,
ltp.grade_id AS gradeId,
lg.`name` AS gradeName,
ltp.models_id AS modelsId,
lm.`name` AS modelsName,
ltp.type_id AS typeId,
lt.`name` AS typeName,
ltp.price,
ltp.place,
ltp.main_image AS mainImage
FROM license_training_programs ltp
INNER JOIN licence_type lt ON ltp.type_id = lt.id
INNER JOIN licence_grade lg ON ltp.grade_id = lg.id
INNER JOIN licence_models lm ON ltp.models_id = lm.id
INNER JOIN license_org_training lot ON lot.training_programs_id = ltp.id
WHERE lot.organizations_id = #{id}
<select id="getOrgName" resultType="java.lang.String">
select `name` from sys_district where id in
<foreach collection="list" open="(" close=")" item="id" separator=",">
#{id}
</foreach>
</select>
......@@ -214,8 +162,8 @@
<if test=" name != null and name != '' ">
and lo.`name` =#{name}
</if>
<if test=" statTime != null and statTime != '' and endTime != null and endTime != '' ">
and DATE_FORMAT(create_time,'%Y-%m-%d') BETWEEN #{statTime} and #{endTime}
<if test=" startTime != null and startTime != '' and endTime != null and endTime != '' ">
and DATE_FORMAT(create_time,'%Y-%m-%d') BETWEEN #{startTime} and #{endTime}
</if>
<if test=" region != null and region != '' ">
and lo.region like CONCAT('%',#{region},'%')
......@@ -240,15 +188,19 @@
lo.create_time AS createTime,
lo.update_time AS updateTime,
lo.detailed_address AS detailedAddress,
lo.region_name AS regionName
lo.region_name AS regionName,
lo.longitude,
lo.latitude,
lo.create_time AS createTime,
lo.update_time AS updateTime
FROM license_organizations lo
LEFT JOIN licence_scale ls ON lo.scale_id = ls.id
where 1=1
<if test=" name != null and name != '' ">
and lo.`name` =#{name}
</if>
<if test=" statTime != null and statTime != '' and endTime != null and endTime != '' ">
and DATE_FORMAT(create_time,'%Y-%m-%d') BETWEEN #{statTime} and #{endTime}
<if test=" startTime != null and startTime != '' and endTime != null and endTime != '' ">
and DATE_FORMAT(create_time,'%Y-%m-%d') BETWEEN #{startTime} and #{endTime}
</if>
<if test=" region != null and region != '' ">
and lo.region like CONCAT('%',#{region},'%')
......@@ -256,12 +208,12 @@
<if test=" id != null and id != '' ">
and lo.id =#{id}
</if>
order by lo.id desc
limit #{pageNo}, #{pageSize}
order by lo.update_time desc, lo.create_time desc
</select>
<select id="trainingProgram" resultType="com.mmc.csf.release.entity.licence.LicenseProgramsDO">
SELECT DISTINCT ltp.id,
SELECT DISTINCT
ltp.id,
ltp.grade_id AS gradeId,
lg.`name` AS gradeName,
ltp.models_id AS modelsId,
......@@ -271,13 +223,14 @@
ltp.price,
ltp.place,
ltp.main_image AS mainImage,
lot.organizations_id AS orgId
FROM license_training_programs ltp
ltp.org_id AS orgId
FROM
license_training_programs ltp
LEFT JOIN licence_grade lg ON ltp.grade_id = lg.id
LEFT JOIN licence_models lm ON ltp.models_id = lm.id
LEFT JOIN licence_type lt ON ltp.type_id = lt.id
LEFT JOIN license_org_training lot ON ltp.id = lot.training_programs_id
where 1=1
WHERE
1 =1
<if test=" modelsId != null and modelsId != '' ">
and ltp.models_id =#{modelsId}
</if>
......
......@@ -35,3 +35,5 @@ data-filter:
- /release/tender/infoById
- /release/wechat/checkSignature
- /release/wechat/mediaCheckAsync
- /release/licence/background/appListOrgPage
- /release/licence/background/webListOrgPage
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论