提交 bb9835c3 作者: 张小凤

LicenceBack(update)

上级 ebd12afc
...@@ -78,4 +78,11 @@ public class LicenseOrganizationsDTO { ...@@ -78,4 +78,11 @@ public class LicenseOrganizationsDTO {
@ApiModelProperty(value = "培训项目", required = false) @ApiModelProperty(value = "培训项目", required = false)
private List<LicenseTrainingProgramsDTO> programsDOList; private List<LicenseTrainingProgramsDTO> programsDOList;
@ApiModelProperty(value = "经度", example = "40.892313123", required = true)
private Double longitude;
@ApiModelProperty(value = "纬度", example = "50.892313123", required = true)
private Double latitude;
} }
...@@ -42,10 +42,16 @@ public class LicenseOrganizationsVO { ...@@ -42,10 +42,16 @@ public class LicenseOrganizationsVO {
@NotBlank(message = "机构地区不能为空", groups = {Create.class, Update.class}) @NotBlank(message = "机构地区不能为空", groups = {Create.class, Update.class})
private String region; private String region;
@ApiModelProperty(value = "机构地区名称", example = "河北省,石家庄市", required = true) @ApiModelProperty(value = "机构地区名称", example = "河北省,石家庄市", required = false)
@NotBlank(message = "机构地区名称", groups = {Create.class, Update.class}) //@NotBlank(message = "机构地区名称", groups = {Create.class, Update.class})
private String regionName; private String regionName;
@ApiModelProperty(value = "经度", example = "40.892313123", required = true)
private Double longitude;
@ApiModelProperty(value = "纬度", example = "50.892313123", required = true)
private Double latitude;
@ApiModelProperty(value = "机构详细地址", example = "南山区", required = true) @ApiModelProperty(value = "机构详细地址", example = "南山区", required = true)
@NotBlank(message = "机构详细地址不能为空", groups = {Create.class, Update.class}) @NotBlank(message = "机构详细地址不能为空", groups = {Create.class, Update.class})
private String detailedAddress; private String detailedAddress;
......
...@@ -38,7 +38,7 @@ public interface LicenceBackgroundDao { ...@@ -38,7 +38,7 @@ public interface LicenceBackgroundDao {
void updateProject(LicenseTrainingProgramsDO programsDO); void updateProject(LicenseTrainingProgramsDO programsDO);
void removeProject(Integer id); void removeProject(Integer id);
List<LicenseProgramsDO> LicenseTrainingProgramsDTO(Integer id); List<LicenseProgramsDO> LicenseTrainingProgramsDTO(Integer id);
int countListOrgPage(LicenseOrganizationsQO organizationsQO); int countListOrgPage(LicenseOrganizationsQO organizationsQO);
...@@ -49,4 +49,6 @@ public interface LicenceBackgroundDao { ...@@ -49,4 +49,6 @@ public interface LicenceBackgroundDao {
List<LicenseProgramsDO> trainingProgram(LicenseOrganizationsQO organizationsQO); List<LicenseProgramsDO> trainingProgram(LicenseOrganizationsQO organizationsQO);
int removeOrg(Integer id); int removeOrg(Integer id);
List<String> getOrgName(List<Integer> orgCode);
} }
...@@ -77,6 +77,12 @@ public class LicenseOrganizationsDO { ...@@ -77,6 +77,12 @@ public class LicenseOrganizationsDO {
private List<LicenseTrainingProgramsDTO> programsDOList; private List<LicenseTrainingProgramsDTO> programsDOList;
@ApiModelProperty(value = "经度", example = "40.892313123", required = true)
private Double longitude;
@ApiModelProperty(value = "纬度", example = "50.892313123", required = true)
private Double latitude;
/** /**
* VO类转换 * VO类转换
*/ */
...@@ -93,6 +99,8 @@ public class LicenseOrganizationsDO { ...@@ -93,6 +99,8 @@ public class LicenseOrganizationsDO {
this.detail = organizationsVO.getDetail(); this.detail = organizationsVO.getDetail();
this.detailedAddress = organizationsVO.getDetailedAddress(); this.detailedAddress = organizationsVO.getDetailedAddress();
this.regionName = organizationsVO.getRegionName(); this.regionName = organizationsVO.getRegionName();
this.longitude = organizationsVO.getLongitude();
this.latitude = organizationsVO.getLatitude();
} }
...@@ -117,6 +125,8 @@ public class LicenseOrganizationsDO { ...@@ -117,6 +125,8 @@ public class LicenseOrganizationsDO {
.detail(this.detail) .detail(this.detail)
.programsDOList(this.programsDOList) .programsDOList(this.programsDOList)
.regionName(this.regionName) .regionName(this.regionName)
.longitude(this.longitude)
.latitude(this.latitude)
.build(); .build();
} }
} }
...@@ -15,10 +15,12 @@ import com.mmc.csf.release.entity.licence.LicenseProgramsDO; ...@@ -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.entity.licence.LicenseTrainingProgramsDO;
import com.mmc.csf.release.service.licence.LicenceBackgroundService; import com.mmc.csf.release.service.licence.LicenceBackgroundService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -41,6 +43,7 @@ public class LicenceBackgroundServiceImpl implements LicenceBackgroundService { ...@@ -41,6 +43,7 @@ public class LicenceBackgroundServiceImpl implements LicenceBackgroundService {
if (count > 0) { if (count > 0) {
return ResultBody.error(ResultEnum.THE_ORGANIZATION_NAME_ALREADY_EXISTS); return ResultBody.error(ResultEnum.THE_ORGANIZATION_NAME_ALREADY_EXISTS);
} }
getOrgName(organizations);
LicenseOrganizationsDO organizationsDO = new LicenseOrganizationsDO(organizations); LicenseOrganizationsDO organizationsDO = new LicenseOrganizationsDO(organizations);
List<Integer> list = new ArrayList<>(); List<Integer> list = new ArrayList<>();
LicenseTrainingProgramsDO programsDO = null; LicenseTrainingProgramsDO programsDO = null;
...@@ -73,6 +76,8 @@ public class LicenceBackgroundServiceImpl implements LicenceBackgroundService { ...@@ -73,6 +76,8 @@ public class LicenceBackgroundServiceImpl implements LicenceBackgroundService {
if (count > 0) { if (count > 0) {
return ResultBody.error(ResultEnum.THE_ORGANIZATION_NAME_ALREADY_EXISTS); return ResultBody.error(ResultEnum.THE_ORGANIZATION_NAME_ALREADY_EXISTS);
} }
getOrgName(organizations);
licenceBackgroundDao.removeOrgAndTraining(organizations.getId()); licenceBackgroundDao.removeOrgAndTraining(organizations.getId());
LicenseTrainingProgramsDO programsDO = null; LicenseTrainingProgramsDO programsDO = null;
List<Integer> list = new ArrayList<>(); List<Integer> list = new ArrayList<>();
...@@ -99,6 +104,15 @@ public class LicenceBackgroundServiceImpl implements LicenceBackgroundService { ...@@ -99,6 +104,15 @@ public class LicenceBackgroundServiceImpl implements LicenceBackgroundService {
return ResultBody.success(); 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 @Override
public ResultBody removeOrganizations(Integer id) { public ResultBody removeOrganizations(Integer id) {
licenceBackgroundDao.removeOrg(id); licenceBackgroundDao.removeOrg(id);
......
...@@ -19,11 +19,11 @@ ...@@ -19,11 +19,11 @@
insert into license_organizations(main_image, auxiliary_picture, video, `name`, region, region_name, insert into license_organizations(main_image, auxiliary_picture, video, `name`, region, region_name,
detailed_address, detailed_address,
test_center, scale_id, 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}, values (#{mainImage}, #{auxiliaryPicture}, #{video}, #{name}, #{region}, #{regionName}, #{detailedAddress},
#{testCenter}, #{testCenter},
#{scaleId}, #{scaleId},
#{description}, #{detail}, NOW(), NOW()) #{description}, #{detail}, NOW(), NOW(), #{longitude}, #{latitude})
</insert> </insert>
<insert id="insertLicenseOrgTraining"> <insert id="insertLicenseOrgTraining">
...@@ -94,6 +94,12 @@ ...@@ -94,6 +94,12 @@
<if test=" detail != null and detail != '' "> <if test=" detail != null and detail != '' ">
detail = #{detail}, detail = #{detail},
</if> </if>
<if test=" longitude != null and longitude != '' ">
longitude = #{longitude},
</if>
<if test=" latitude != null and latitude != '' ">
latitude = #{latitude},
</if>
update_time=NOW() update_time=NOW()
</set> </set>
where id = #{id} where id = #{id}
...@@ -186,6 +192,14 @@ ...@@ -186,6 +192,14 @@
where id = #{id} where id = #{id}
</delete> </delete>
<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>
<select id="LicenseTrainingProgramsDTO" resultType="com.mmc.csf.release.entity.licence.LicenseProgramsDO"> <select id="LicenseTrainingProgramsDTO" resultType="com.mmc.csf.release.entity.licence.LicenseProgramsDO">
SELECT ltp.id, SELECT ltp.id,
ltp.grade_id AS gradeId, ltp.grade_id AS gradeId,
...@@ -240,7 +254,9 @@ ...@@ -240,7 +254,9 @@
lo.create_time AS createTime, lo.create_time AS createTime,
lo.update_time AS updateTime, lo.update_time AS updateTime,
lo.detailed_address AS detailedAddress, lo.detailed_address AS detailedAddress,
lo.region_name AS regionName lo.region_name AS regionName,
lo.longitude,
lo.latitude
FROM license_organizations lo FROM license_organizations lo
LEFT JOIN licence_scale ls ON lo.scale_id = ls.id LEFT JOIN licence_scale ls ON lo.scale_id = ls.id
where 1=1 where 1=1
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论