Commit 07e123ac authored by chenying's avatar chenying

5.25修改图片地址,修改公司接口,登录添加公司编号

parent 16f97eb9
......@@ -5,6 +5,8 @@ public class AddCompanyVo {
private String companyName;
private String alias;
private String country;
private String city;
......@@ -15,6 +17,24 @@ public class AddCompanyVo {
private String manager;
private String img;
public String getAlias() {
return alias;
}
public void setAlias(String alias) {
this.alias = alias;
}
public String getImg() {
return img;
}
public void setImg(String img) {
this.img = img;
}
public String getCompanyNo() {
return companyNo;
}
......
......@@ -5,6 +5,8 @@ public class ResultCompanyVo {
private String companyName;
private String alias;
private String country;
private String city;
......@@ -15,6 +17,24 @@ public class ResultCompanyVo {
private String manager;
private String img;
public String getAlias() {
return alias;
}
public void setAlias(String alias) {
this.alias = alias;
}
public String getImg() {
return img;
}
public void setImg(String img) {
this.img = img;
}
public String getCompanyNo() {
return companyNo;
}
......
......@@ -19,6 +19,16 @@ public class ResultTDLDeviceVo {
private String gatewayType;
private String companyName;
public String getCompanyName() {
return companyName;
}
public void setCompanyName(String companyName) {
this.companyName = companyName;
}
public String getTDLName() {
return TDLName;
}
......
......@@ -5,6 +5,8 @@ public class UpdateCompanyVo {
private String companyName;
private String alias;
private String country;
private String city;
......@@ -15,6 +17,14 @@ public class UpdateCompanyVo {
private String manager;
public String getAlias() {
return alias;
}
public void setAlias(String alias) {
this.alias = alias;
}
public String getCompanyNo() {
return companyNo;
}
......
......@@ -13,8 +13,18 @@ public class UserRedisVo {
private String roleName;
private String companyNo;
private String companyName;
public String getCompanyNo() {
return companyNo;
}
public void setCompanyNo(String companyNo) {
this.companyNo = companyNo;
}
public String getCompanyName() {
return companyName;
}
......@@ -71,13 +81,14 @@ public class UserRedisVo {
this.roleName = roleName;
}
public UserRedisVo(String userName, String userNumber, String nickName, String email, String phone, String roleName,String companyName) {
public UserRedisVo(String userName, String userNumber, String nickName, String email, String phone, String roleName,String companyNo,String companyName) {
UserName = userName;
UserNumber = userNumber;
this.nickName = nickName;
this.email = email;
this.phone = phone;
this.roleName = roleName;
this.companyNo=companyNo;
this.companyName=companyName;
}
}
......@@ -17,8 +17,18 @@ public class UserVo {
private String roleName;
private String companyNo;
private String companyName;
public String getCompanyNo() {
return companyNo;
}
public void setCompanyNo(String companyNo) {
this.companyNo = companyNo;
}
public String getCompanyName() {
return companyName;
}
......
......@@ -21,4 +21,6 @@ public interface CarMapper {
int delCar(String carNo);
int updateImg(@Param("img") String img,@Param("carNo") String carNo);
}
......@@ -5,6 +5,7 @@ import com.example.tdl.domain.vo.AddCompanyVo;
import com.example.tdl.domain.vo.ResultCompanyVo;
import com.example.tdl.domain.vo.UpdateCompanyVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
......@@ -23,4 +24,8 @@ public interface CompanyMapper {
ResultCompanyVo getByCompanyName(String companyName);
ResultCompanyVo getByCompanyNo(String companyNo);
ResultCompanyVo getByAlias(String alias);
int updateImg(@Param("img") String img, @Param("companyNo") String companyNo);
}
......@@ -33,4 +33,6 @@ public interface UserMapper {
int delUser(String userNumber);
int updatePassword(UpdatePasswordVo updatePasswordVo);
int updateImg(@Param("img") String img,@Param("userNumber") String userNumber);
}
......@@ -39,5 +39,9 @@ public class CarService {
return carMapper.delCar(carNo);
}
public int updateImg(String img,String carNo){
return carMapper.updateImg(img,carNo);
}
}
......@@ -41,4 +41,12 @@ public class CompanyService {
return companyMapper.getByCompanyNo(companyNo);
}
public ResultCompanyVo getByAlias(String alias){
return companyMapper.getByAlias(alias);
}
public int updateImg(String img,String companyNo){
return companyMapper.updateImg(img,companyNo);
}
}
......@@ -82,9 +82,13 @@ public class UserService {
return null;
}
String token = DigestUtils.md5Hex(System.currentTimeMillis() + userVo.getUserName());
UserRedisVo redisVo = new UserRedisVo(userVo.getUserName(),userVo.getUserNumber(),userVo.getNickName(),userVo.getEmail(),userVo.getPhone(),userVo.getRoleName(),userVo.getCompanyName());
UserRedisVo redisVo = new UserRedisVo(userVo.getUserName(),userVo.getUserNumber(),userVo.getNickName(),userVo.getEmail(),userVo.getPhone(),userVo.getRoleName(),userVo.getCompanyNo(),userVo.getCompanyName());
//将用户数据保存到redis中
redisService.set("TOKEN_" + token, gson.toJson(redisVo), 60 * 30);
return token;
}
public int updateImg(String img,String userNumber){
return userMapper.updateImg(img,userNumber);
}
}
......@@ -53,11 +53,13 @@ public class CompanyController {
@ApiOperation(value = "查询所有公司信息",notes = "查询所有公司信息,返回值说明:" +
" companyNo:公司编号," +
" companyName:公司名," +
" alias:别名," +
" country:国家," +
" city:城市," +
" addressDetail:具体地址," +
" tel:电话号码," +
" manager:负责人")
" manager:负责人," +
" img:图片地址")
@ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
@ApiImplicitParam(paramType="header", name = "AccountLanguage", value = "language", required = false, dataType = "String"),
......@@ -81,10 +83,12 @@ public class CompanyController {
@ApiOperation(value = "添加公司信息",notes = "添加公司信息,companyNo公司编号不用传,需要传的值:" +
" companyName:公司名," +
" country:国家," +
" alias:别名," +
" city:城市," +
" addressDetail:具体地址," +
" tel:电话号码," +
" manager:负责人")
" manager:负责人," +
" img:图片地址")
@ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
@ApiImplicitParam(paramType="header", name = "AccountLanguage", value = "language", required = false, dataType = "String"),
......@@ -97,6 +101,11 @@ public class CompanyController {
fb.setMessage(i18n.getMessage(request,"companyName"));
return gson.toJson(fb);
}
if (StringUtils.isEmpty(addCompanyVo.getAlias())){
fb.setCode(0);
fb.setMessage(i18n.getMessage(request,"alias"));
return gson.toJson(fb);
}
if (StringUtils.isEmpty(addCompanyVo.getCountry())){
fb.setCode(0);
fb.setMessage(i18n.getMessage(request,"country"));
......@@ -132,6 +141,11 @@ public class CompanyController {
fb.setMessage(i18n.getMessage(request,"repeateCompanyName"));
return gson.toJson(fb);
}
if (companyService.getByAlias(addCompanyVo.getAlias())!=null){
fb.setCode(0);
fb.setMessage(i18n.getMessage(request,"repeateAlias"));
return gson.toJson(fb);
}
Date day=new Date();
SimpleDateFormat df = new SimpleDateFormat("yyyyMMdd");
String companyNo="TM"+df.format(day);
......@@ -174,6 +188,11 @@ public class CompanyController {
fb.setMessage(i18n.getMessage(request,"companyNo"));
return gson.toJson(fb);
}
if (StringUtils.isEmpty(updateCompanyVo.getAlias())){
fb.setCode(0);
fb.setMessage(i18n.getMessage(request,"alias"));
return gson.toJson(fb);
}
if (StringUtils.isEmpty(updateCompanyVo.getCompanyName())){
fb.setCode(0);
fb.setMessage(i18n.getMessage(request,"companyName"));
......@@ -209,12 +228,17 @@ public class CompanyController {
fb.setMessage(i18n.getMessage(request,"manager"));
return gson.toJson(fb);
}
if (companyService.getByCompanyName(updateCompanyVo.getCompanyName())!=null&&!companyService.getByCompanyNo(updateCompanyVo.getCompanyNo()).getCompanyName().equals(updateCompanyVo.getCompanyName())){
ResultCompanyVo resultCompanyVo=companyService.getByCompanyNo(updateCompanyVo.getCompanyNo());
if (companyService.getByCompanyName(updateCompanyVo.getCompanyName())!=null&&!resultCompanyVo.getCompanyName().equals(updateCompanyVo.getCompanyName())){
fb.setCode(0);
fb.setMessage(i18n.getMessage(request,"repeateCompanyName"));
return gson.toJson(fb);
}
if (companyService.getByAlias(updateCompanyVo.getAlias())!=null&&!resultCompanyVo.getAlias().equals(updateCompanyVo.getAlias())){
fb.setCode(0);
fb.setMessage(i18n.getMessage(request,"repeateAlias"));
return gson.toJson(fb);
}
int a = companyService.updateCompany(updateCompanyVo);
if (a>0){
fb.setCode(1);
......
......@@ -75,7 +75,7 @@ public class LoginController {
SecurityUtils.getSubject().login(new UsernamePasswordToken(loginUserVo.getUserName(), loginUserVo.getPassword()));
//生成token
String token = DigestUtils.md5Hex(System.currentTimeMillis() + userVo.getUserName());
UserRedisVo redisVo = new UserRedisVo(userVo.getUserName(),userVo.getUserNumber(),userVo.getNickName(),userVo.getEmail(),userVo.getPhone(),userVo.getRoleName(),userVo.getCompanyName());
UserRedisVo redisVo = new UserRedisVo(userVo.getUserName(),userVo.getUserNumber(),userVo.getNickName(),userVo.getEmail(),userVo.getPhone(),userVo.getRoleName(),userVo.getCompanyNo(),userVo.getCompanyName());
//将用户数据保存到redis中
tokenRedisService.set("TOKEN_" + token, gson.toJson(redisVo), 60 * 60 *24);
String ip = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest().getRemoteAddr();
......
......@@ -93,6 +93,7 @@ startCircuitSuccess = \u7EBF\u8DEF\u5F00\u59CB\u8FD0\u8F93\u6210\u529F
startCircuitFailure = \u7EBF\u8DEF\u5F00\u59CB\u8FD0\u8F93\u5931\u8D25
#\u516C\u53F8
companyName = \u516C\u53F8\u540D\u4E0D\u80FD\u4E3A\u7A7A
alias= \u522B\u540D\u4E0D\u80FD\u4E3A\u7A7A
country = \u56FD\u5BB6\u4E0D\u80FD\u4E3A\u7A7A
city = \u57CE\u5E02\u4E0D\u80FD\u4E3A\u7A7A
addressDetail = \u5177\u4F53\u5730\u5740\u4E0D\u80FD\u4E3A\u7A7A
......@@ -100,6 +101,7 @@ tel = \u8054\u7CFB\u7535\u8BDD\u4E0D\u80FD\u4E3A\u7A7A
manager = \u8D1F\u8D23\u4EBA\u4E0D\u80FD\u4E3A\u7A7A
wrongTel = \u624B\u673A\u53F7\u4E0D\u89C4\u8303
repeateCompanyName = \u516C\u53F8\u540D\u4E0D\u80FD\u91CD\u590D
repeateAlias = \u522B\u540D\u4E0D\u80FD\u91CD\u590D
addCompanySuccess = \u6DFB\u52A0\u516C\u53F8\u6210\u529F
addCompanyFailure = \u6DFB\u52A0\u516C\u53F8\u5931\u8D25
companyNo = \u516C\u53F8\u7F16\u53F7\u4E0D\u80FD\u4E3A\u7A7A
......
......@@ -50,4 +50,8 @@
DELETE from car WHERE carNo=#{carNo,jdbcType=VARCHAR}
</delete>
<update id="updateImg" parameterType="String">
update car set img=#{img,jdbcType=VARCHAR} WHERE carNo=#{carNo,jdbcType=VARCHAR}
</update>
</mapper>
\ No newline at end of file
......@@ -3,7 +3,7 @@
<mapper namespace="com.example.tdl.mapper.CompanyMapper">
<!--查询所有公司信息-->
<select id="getAll" resultType="com.example.tdl.domain.vo.ResultCompanyVo">
SELECT companyNo,companyName,country,city,addressDetail,tel,manager from company WHERE state=1
SELECT companyNo,companyName,alias,country,city,addressDetail,tel,manager,img from company WHERE state=1
</select>
<insert id="addCompany" parameterType="com.example.tdl.domain.vo.AddCompanyVo">
......@@ -11,11 +11,13 @@
NULL ,
#{companyNo,jdbcType=VARCHAR},
#{companyName,jdbcType=VARCHAR},
#{alias,jdbcType=VARCHAR},
#{country,jdbcType=VARCHAR},
#{city,jdbcType=VARCHAR},
#{addressDetail,jdbcType=VARCHAR},
#{tel,jdbcType=VARCHAR},
#{manager,jdbcType=VARCHAR},
#{img,jdbcType=VARCHAR},
1
)
</insert>
......@@ -24,6 +26,7 @@
UPDATE company set
companyName=#{companyName,jdbcType=VARCHAR},
country=#{country,jdbcType=VARCHAR},
alias=#{alias,jdbcType=VARCHAR},
city=#{city,jdbcType=VARCHAR},
addressDetail=#{addressDetail,jdbcType=VARCHAR},
tel=#{tel,jdbcType=VARCHAR},
......@@ -43,12 +46,22 @@
</delete>
<select id="getByCompanyName" parameterType="String" resultType="com.example.tdl.domain.vo.ResultCompanyVo">
SELECT companyNo,companyName,country,city,addressDetail,tel,manager
SELECT companyNo,companyName,alias,country,city,addressDetail,tel,manager,img
from company WHERE state=1 AND companyName=#{companyName,jdbcType=VARCHAR}
</select>
<select id="getByCompanyNo" parameterType="String" resultType="com.example.tdl.domain.vo.ResultCompanyVo">
SELECT companyNo,companyName,country,city,addressDetail,tel,manager
SELECT companyNo,companyName,alias,country,city,addressDetail,tel,manager,img
from company WHERE state=1 AND companyNo=#{companyNo,jdbcType=VARCHAR}
</select>
<select id="getByAlias" parameterType="String" resultType="com.example.tdl.domain.vo.ResultCompanyVo">
SELECT companyNo,companyName,alias,country,city,addressDetail,tel,manager,img
from company WHERE state=1 AND alias=#{alias,jdbcType=VARCHAR}
</select>
<update id="updateImg" parameterType="String">
update company set img=#{img,jdbcType=VARCHAR} WHERE companyNo=#{companyNo,jdbcType=VARCHAR}
</update>
</mapper>
\ No newline at end of file
......@@ -5,15 +5,17 @@
<select id="getAll" resultType="com.example.tdl.domain.vo.ResultTDLDeviceVo">
SELECT TDLName,TDLSN,counts,lastTime,useScene,(SELECT warehouseName from warehouse WHERE id=t.warehouse_id) warehouseName,
(SELECT transportationNo from circuit WHERE id=t.circuit_id) transportationNo,(SELECT SN from gateway WHERE id=t.gateway_id) gatewaySN,
(SELECT type from gateway WHERE id=t.gateway_id) gatewayType
from tdldevice t
(SELECT type from gateway WHERE id=t.gateway_id) gatewayType,companyName
from tdldevice t INNER JOIN company c ON t.company_id=c.id
AND companyName=#{companyName,jdbcType=VARCHAR}
</select>
<!--根据条件查询-->
<select id="getByTerm" resultType="com.example.tdl.domain.vo.ResultTDLDeviceVo" parameterType="com.example.tdl.domain.vo.TDLDeviceTermVo">
SELECT TDLName,TDLSN,counts,lastTime,useScene,(SELECT warehouseName from warehouse WHERE id=t.warehouse_id) warehouseName,
(SELECT transportationNo from circuit WHERE id=t.circuit_id) transportationNo,(SELECT SN from gateway WHERE id=t.gateway_id) gatewaySN,(SELECT type from gateway WHERE id=t.gateway_id) gatewayType
from tdldevice t where 1=1
(SELECT transportationNo from circuit WHERE id=t.circuit_id) transportationNo,(SELECT SN from gateway WHERE id=t.gateway_id) gatewaySN,
(SELECT type from gateway WHERE id=t.gateway_id) gatewayType,companyName
from tdldevice t INNER JOIN company c ON t.company_id=c.id where 1=1
<if test="TDLName!=null">
AND TDLName like CONCAT(CONCAT('%',#{TDLName,jdbcType=VARCHAR}), '%')
</if>
......@@ -23,19 +25,21 @@
<if test="useScene!=null">
AND useScene=#{useScene,jdbcType=INTEGER}
</if>
AND companyName=#{companyName,jdbcType=VARCHAR}
</select>
<insert id="addTDLDevice" parameterType="com.example.tdl.domain.vo.AddTDLDeviceVo">
INSERT INTO TDLDevice VALUES (
NULL ,
#{TDLName,jdbcType=VARCHAR},
#{TDLSN,jdbcType=VARCHAR},
0,
0,
0,
NULL ,
NULL,
NULL
NULL ,
#{TDLName,jdbcType=VARCHAR},
#{TDLSN,jdbcType=VARCHAR},
0,
0,
0,
NULL ,
NULL,
NULL,
(SELECT id from company where companyName=#{companyName,jdbcType=VARCHAR})
)
</insert>
......@@ -43,6 +47,7 @@
UPDATE TDLDevice SET
TDLName=#{TDLName,jdbcType=VARCHAR}
WHERE TDLSN=#{TDLSN,jdbcType=VARCHAR}
AND company_id=(SELECT id from company where companyName=#{companyName,jdbcType=VARCHAR})
</update>
<delete id="delTDLDevice" parameterType="String">
......@@ -51,8 +56,9 @@
<select id="getByTDLSN" parameterType="String" resultType="com.example.tdl.domain.vo.ResultTDLDeviceVo">
SELECT TDLName,TDLSN,counts,lastTime,useScene,(SELECT warehouseName from warehouse WHERE id=t.warehouse_id) warehouseName,
(SELECT transportationNo from circuit WHERE id=t.circuit_id) transportationNo,(SELECT SN from gateway WHERE id=t.gateway_id) gatewaySN,(SELECT type from gateway WHERE id=t.gateway_id) gatewayType
from tdldevice t
(SELECT transportationNo from circuit WHERE id=t.circuit_id) transportationNo,(SELECT SN from gateway WHERE id=t.gateway_id) gatewaySN,
(SELECT type from gateway WHERE id=t.gateway_id) gatewayType,companyName
from tdldevice t INNER JOIN company c ON t.company_id=c.id
WHERE TDLSN=#{TDLSN,jdbcType=VARCHAR}
</select>
......
......@@ -11,7 +11,7 @@
<!--通过用户名查询用户信息-->
<select id="getByUserName" parameterType="String" resultType="com.example.tdl.domain.vo.UserVo">
select userNumber, userName,password,nickName,phone,email,roleName,c.companyName
select userNumber, userName,password,nickName,phone,email,roleName,c.companyNo,c.companyName
from company c,`user` u INNER JOIN role r ON u.role_id=r.id
WHERE u.company_id=c.id
AND userName=#{userName,jdbcType=VARCHAR}
......@@ -118,7 +118,7 @@
<!--删除用户-->
<delete id="delUser" parameterType="String">
DELETE FROM `user` WHERE userNumber=#{userNumber}
DELETE FROM `user` WHERE userNumber=#{userNumber,jdbcType=VARCHAR}
</delete>
<!--修改密码-->
......@@ -129,4 +129,8 @@
WHERE userNumber=#{userNumber,jdbcType=VARCHAR}
</update>
<update id="updateImg" parameterType="String">
update `user` set img=#{img,jdbcType=VARCHAR} WHERE userNumber=#{userNumber,jdbcType=VARCHAR}
</update>
</mapper>
\ No newline at end of file
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