Commit a90a6a34 authored by eddie.woo's avatar eddie.woo

fix bug

parent 115c76fc
package pwc.taxtech.atms.common;
public class ServiceException extends Exception {
public ServiceException() {
}
public ServiceException(String message) {
super(message);
}
public ServiceException(String message, Throwable cause) {
super(message, cause);
}
public ServiceException(Throwable cause) {
super(cause);
}
}
......@@ -6,15 +6,13 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.ApiOperation;
import pwc.taxtech.atms.dto.MenuDisplayDto;
import pwc.taxtech.atms.dto.MenuDto;
import pwc.taxtech.atms.dto.OperationResultDto;
import pwc.taxtech.atms.entitiy.Menu;
import pwc.taxtech.atms.service.MenuService;
/** @see PwC.Tax.Tech.Atms.WebApi\Controllers\MenuController.cs */
......@@ -40,4 +38,17 @@ public class MenuController {
logger.info("come into menu");
return menuService.getMenus(serviceId);
}
@ResponseBody
@ApiOperation(value = "更新菜单项", notes = "更新菜单项")
@RequestMapping(method = RequestMethod.PUT)
public OperationResultDto updateMenu(@RequestBody Menu menu) {
try {
menuService.update(menu);
return OperationResultDto.success();
} catch (Exception e) {
logger.error("更新菜单项失败", e);
}
return OperationResultDto.error();
}
}
......@@ -2,6 +2,7 @@ package pwc.taxtech.atms.controller;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -178,6 +179,9 @@ public class OrganizationController {
@RequestMapping(value = "add", method = RequestMethod.POST)
public @ResponseBody OperationResultDto<Object> addOrg(@RequestBody OrganizationDto orgDto) {
logger.info("POST /api/v1/org/add");
if (StringUtils.isBlank(orgDto.getClientCode()) && StringUtils.isNotBlank(orgDto.getCode())) {
orgDto.setClientCode(orgDto.getCode());
}
return organizationService.addOrg(orgDto);
}
......@@ -185,6 +189,9 @@ public class OrganizationController {
@RequestMapping(value = "update", method = RequestMethod.PUT)
public @ResponseBody OperationResultDto<Object> updateOrg(@RequestBody OrganizationDto orgDto) {
logger.info("PUT /api/v1/org/update");
if (StringUtils.isBlank(orgDto.getClientCode()) && StringUtils.isNotBlank(orgDto.getCode())) {
orgDto.setClientCode(orgDto.getCode());
}
return organizationService.updateOrg(orgDto);
}
......
package pwc.taxtech.atms.controller;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import pwc.taxtech.atms.dto.ServiceTypeDto;
import pwc.taxtech.atms.service.ProjectService;
import java.util.List;
@RestController
@RequestMapping("/api/v1/servicetype/")
public class ServiceTypeController {
@Autowired
private ProjectService projectService;
@ApiOperation(value = "获取ServiceType列表")
@RequestMapping(value = "getlist", method = RequestMethod.GET)
public @ResponseBody List<ServiceTypeDto> getList() {
return projectService.getServiceList();
}
}
......@@ -29,7 +29,7 @@ public interface MyUserMapper extends MyMapper {
List<Map<String, Object>> selectUserOrganizationMapByUserID(@Param(value = "userID") String userID);
@Select("select urd.ID, urd.DimensionValueID, urd.DimensionID, urd.UserID, urd.IsAccessible, urd.HasOriginalRole, u.UserName "
+ "from UserDimensionValue as urd " + "join \"USER\" as u on urd.UserID = u.ID " + "where u.Status = 1")
+ "from UserDimensionValue as urd " + "join User as u on urd.UserID = u.ID " + "where u.Status = 1")
@Results({ @Result(id = true, column = "ID", property = "ID"),
@Result(column = "DimensionValueID", property = "dimensionValueID", javaType = String.class),
@Result(column = "DimensionID", property = "dimensionID", javaType = String.class),
......@@ -45,7 +45,7 @@ public interface MyUserMapper extends MyMapper {
@Result(column = "RoleName", property = "roleName", javaType = String.class) })
List<Map<String, String>> selectUserRoleListByUserID(@Param(value = "userId") String userId);
@Select("select q.ID, q.OrganizationID, q.UserID, q.IsAccessible, q.HasOriginalRole from UserOrganization as q join \"USER\" as u on q.UserID = u.ID "
@Select("select q.ID, q.OrganizationID, q.UserID, q.IsAccessible, q.HasOriginalRole from UserOrganization as q join User as u on q.UserID = u.ID "
+ "where u.Status = 1")
@Results({ @Result(id = true, column = "ID", property = "ID"),
@Result(column = "OrganizationID", property = "organizationID"),
......@@ -67,7 +67,7 @@ public interface MyUserMapper extends MyMapper {
@Param(value = "dimensionID") String dimensionID);
@Select("select urd.ID, urd.OrganizationID as OrgID, urd.UserID, urd.IsAccessible, urd.HasOriginalRole, u.UserName as UserName "
+ "from UserOrganization as urd join \"USER\" as u on urd.UserID = u.ID where u.Status = 1")
+ "from UserOrganization as urd join User as u on urd.UserID = u.ID where u.Status = 1")
@Results({ @Result(id = true, column = "ID", property = "ID"),
@Result(column = "OrgID", property = "orgID", javaType = String.class),
@Result(column = "UserID", property = "userID", javaType = String.class),
......
......@@ -138,7 +138,7 @@ public interface UserMapper extends MyMapper {
@Select("select u.UserName as UserName, o.ID as OrganizationID, o.Name as OrganizationName, "
+ "u.Email as Email, u.Status as Status, u.AttemptTimes as AttemptTimes, u.CreateTime as CreateTime, "
+ "u.ExpirationDate as ExpirationDate, u.IsAdmin as IsAdmin, u.ID as ID, u.LockedTime as LockedTime, "
+ "u.LoginType as LoginType, u.Password as Password, u.PasswordUpdateTime as PasswordUpdateTime, u.UpdateTime as UpdateTime from \"USER\" as u "
+ "u.LoginType as LoginType, u.Password as Password, u.PasswordUpdateTime as PasswordUpdateTime, u.UpdateTime as UpdateTime from User as u "
+ "left join Organization as o on u.OrganizationID = o.ID "
+ "where u.ID = #{userId}")
@Results({
......
......@@ -35,7 +35,11 @@ public class OperationResultDto<T> extends OperationResultBase {
}
public static OperationResultDto<?> error() {
return new OperationResultDto<>(false, null);
return OperationResultDto.error(null);
}
public static OperationResultDto<?> error(String msg) {
return new OperationResultDto<>(false, msg);
}
public Map<String, String> getErrors() {
......
package pwc.taxtech.atms.entitiy;
import com.alibaba.fastjson.annotation.JSONField;
import java.io.Serializable;
import java.util.Date;
......@@ -18,6 +20,7 @@ public class Menu implements Serializable {
*
* @mbg.generated
*/
@JSONField(name = "id")
private String ID;
/**
......
......@@ -87,7 +87,7 @@ public class Region implements Serializable, Cloneable {
*
* @mbg.generated
*/
private Integer zipCode;
private String zipCode;
/**
*
......@@ -309,7 +309,7 @@ public class Region implements Serializable, Cloneable {
*
* @mbg.generated
*/
public Integer getZipCode() {
public String getZipCode() {
return zipCode;
}
......@@ -321,7 +321,7 @@ public class Region implements Serializable, Cloneable {
*
* @mbg.generated
*/
public void setZipCode(Integer zipCode) {
public void setZipCode(String zipCode) {
this.zipCode = zipCode;
}
......
......@@ -14,4 +14,6 @@ public interface MenuService {
List<Menu> findByIsActive(Boolean isActive);
void update(Menu menu);
}
......@@ -5,6 +5,8 @@ import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
import org.apache.commons.lang3.StringUtils;
import org.nutz.lang.Strings;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -56,7 +58,8 @@ public class AreaServiceImpl implements AreaService {
AreaExample areaExample = new AreaExample();
Criteria criteria = areaExample.createCriteria();
criteria.andParentIDIsNull();
// criteria.andParentIDIsNull();
criteria.andParentIDEqualTo(StringUtils.EMPTY);
return areaMapper.selectByExample(areaExample);
......@@ -226,7 +229,7 @@ public class AreaServiceImpl implements AreaService {
List<AreaDto> areaList = getAreaList(type);
// Top Node
List<AreaDto> topNode = areaList.stream().filter(sa -> sa.getParentID() == null).collect(Collectors.toList());
List<AreaDto> topNode = areaList.stream().filter(sa -> StringUtils.isBlank(sa.getParentID())).collect(Collectors.toList());
if (topNode == null) {
throw new ApplicationException(AreaMessage.NoAreaRootData);
}
......
......@@ -120,4 +120,9 @@ public class MenuServiceImpl implements MenuService {
return menuMapper.selectByExample(menuExample);
}
@Override
public void update(Menu menu) {
menuMapper.updateByPrimaryKeySelective(menu);
}
}
......@@ -269,23 +269,24 @@ public class UserAccountServiceImpl extends AbstractService implements UserAccou
@Override
public OperationResultDto<User> addNewUser(UserAndUserRoleSaveDto userAndUserRoleSaveDto) {
OperationResultDto<User> user = addUser(userAndUserRoleSaveDto);
if (BooleanUtils.isTrue(user.getResult())) {
MailMto mailMto = new MailMto();
String path = MAIL_TEMPLATE_PATH + "WebAdminWelcomeLetter.html";
String content = CommonUtils.readClasspathFileToString(path);
content = content.replaceAll("\\{Password\\}", user.getResultMsg());
content = content.replaceAll("\\{\\[Env\\]link\\}", atmsApiSettings.getWebUrl());
content = content.replaceAll("\\{UserName\\}", user.getData().getUserName());
mailMto.setContent(content);
// Get Subject Avoid Multi-language
String beginTag = "<title>";
int beginIndex = content.indexOf(beginTag);
int endIndex = content.indexOf("</title>");
String subject = content.substring(beginIndex + beginTag.length(), endIndex);
mailMto.setSubject(subject);
mailMto.setTo(user.getData().getEmail());
commonService.sendMail(mailMto);
}
//todo send mail
// if (BooleanUtils.isTrue(user.getResult())) {
// MailMto mailMto = new MailMto();
// String path = MAIL_TEMPLATE_PATH + "WebAdminWelcomeLetter.html";
// String content = CommonUtils.readClasspathFileToString(path);
// content = content.replaceAll("\\{Password\\}", user.getResultMsg());
// content = content.replaceAll("\\{\\[Env\\]link\\}", atmsApiSettings.getWebUrl());
// content = content.replaceAll("\\{UserName\\}", user.getData().getUserName());
// mailMto.setContent(content);
// // Get Subject Avoid Multi-language
// String beginTag = "<title>";
// int beginIndex = content.indexOf(beginTag);
// int endIndex = content.indexOf("</title>");
// String subject = content.substring(beginIndex + beginTag.length(), endIndex);
// mailMto.setSubject(subject);
// mailMto.setTo(user.getData().getEmail());
// commonService.sendMail(mailMto);
// }
return user;
}
......@@ -343,7 +344,7 @@ public class UserAccountServiceImpl extends AbstractService implements UserAccou
.orElse(new Role()).getServiceTypeID());
userRoleList.add(userRole);
logger.debug("Start to insert user role [ {} ]", userRole.getID());
userRoleMapper.insert(userRole);
userRoleMapper.insertSelective(userRole);
}
}
// 默认添加机构可访问权限
......
......@@ -267,32 +267,32 @@
<select id="selectUnionDimensionValueOrgByDimension" parameterType="pwc.taxtech.atms.dto.DimensionParamDto" resultMap="UnionDimensionValueOrg">
select * from
(select #{organizationStructureID} as "ID", StructureID as DimensionValueID, "ID" as
OrganizationID from "Organization"
(select #{organizationStructureID} as ID, StructureID as DimensionValueID, ID as
OrganizationID from Organization
union
select #{businessUnitID} as "ID", BusinessUnitID as DimensionValueID, "ID" as
OrganizationID from "Organization"
select #{businessUnitID} as ID, BusinessUnitID as DimensionValueID, ID as
OrganizationID from Organization
union
select #{areaID} as "ID", AreaID as DimensionValueID, "ID" as OrganizationID
from "Organization"
select #{areaID} as ID, AreaID as DimensionValueID, ID as OrganizationID
from Organization
union
select ID, DimensionValueID, OrganizationID from DimensionValueOrg) as q
join
(select "ID" as "DimensionValueID", "Name" as "DimensionValueName",
"IsActive", #{organizationStructureID} as "DimensionID", CreateTime, UpdateTime from
"OrganizationStructure" where "IsActive"=1
(select ID as DimensionValueID, Name as DimensionValueName,
IsActive, #{organizationStructureID} as DimensionID, CreateTime, UpdateTime from
OrganizationStructure where IsActive=1
union
select "ID" as "DimensionValueID", "Name" as "DimensionValueName",
"IsActive", #{businessUnitID} as "DimensionID", CreateTime, UpdateTime from
"BusinessUnit" where "IsActive"=1
select ID as DimensionValueID, Name as DimensionValueName,
IsActive, #{businessUnitID} as DimensionID, CreateTime, UpdateTime from
BusinessUnit where IsActive=1
union
select "ID" as "DimensionValueID", "Name" as "DimensionValueName",
"IsActive", #{areaID} as "DimensionID", GETDATE() as CreateTime,
GETDATE() as UpdateTime from "Area" where "IsActive"=1
select ID as DimensionValueID, Name as DimensionValueName,
IsActive, #{areaID} as DimensionID, now() as CreateTime,
now() as UpdateTime from Area where IsActive=1
union
select "ID" as "DimensionValueID", "Name" as "DimensionValueName",
"IsActive", DimensionID, CreateTime, UpdateTime from "DimensionValue"
where "IsActive"=1) as p
select ID as DimensionValueID, Name as DimensionValueName,
IsActive, DimensionID, CreateTime, UpdateTime from DimensionValue
where IsActive=1) as p
on p.DimensionValueID = q.DimensionValueID
join
Dimension as r on r.IsActive = 1 and p.DimensionID = r.ID
......
......@@ -393,14 +393,77 @@
</select>
<insert id="insertSmart" parameterType="pwc.taxtech.atms.entitiy.OperationLogSmart">
insert into ${tableName} (ID, OperationContent, ModuleName,
OperationObject, OperationAction, OriginalState,
UpdateState, OperationUser, IP,
"Comment", CreateTime)
values (#{ID,jdbcType=VARCHAR}, #{operationContent,jdbcType=NVARCHAR}, #{moduleName,jdbcType=NVARCHAR},
#{operationObject,jdbcType=NVARCHAR}, #{operationAction,jdbcType=NVARCHAR}, #{originalState,jdbcType=NVARCHAR},
#{updateState,jdbcType=NVARCHAR}, #{operationUser,jdbcType=NVARCHAR}, #{IP,jdbcType=VARCHAR},
#{comment,jdbcType=NVARCHAR}, #{createTime,jdbcType=TIMESTAMP})
insert into ${tableName}
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="ID != null">
ID,
</if>
<if test="operationContent != null">
OperationContent,
</if>
<if test="moduleName != null">
ModuleName,
</if>
<if test="operationObject != null">
OperationObject,
</if>
<if test="operationAction != null">
OperationAction,
</if>
<if test="originalState != null">
OriginalState,
</if>
<if test="updateState != null">
UpdateState,
</if>
<if test="operationUser != null">
OperationUser,
</if>
<if test="IP != null">
IP,
</if>
<if test="comment != null">
Comment,
</if>
<if test="createTime != null">
CreateTime,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="ID != null">
#{ID,jdbcType=VARCHAR},
</if>
<if test="operationContent != null">
#{operationContent,jdbcType=VARCHAR},
</if>
<if test="moduleName != null">
#{moduleName,jdbcType=VARCHAR},
</if>
<if test="operationObject != null">
#{operationObject,jdbcType=VARCHAR},
</if>
<if test="operationAction != null">
#{operationAction,jdbcType=VARCHAR},
</if>
<if test="originalState != null">
#{originalState,jdbcType=VARCHAR},
</if>
<if test="updateState != null">
#{updateState,jdbcType=VARCHAR},
</if>
<if test="operationUser != null">
#{operationUser,jdbcType=VARCHAR},
</if>
<if test="IP != null">
#{IP,jdbcType=VARCHAR},
</if>
<if test="comment != null">
#{comment,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
......
......@@ -833,7 +833,7 @@
org.RegionID as RegionID,
reg.MergerName as RegionName,
org.IsActive as IsActive
from "Organization" as org
from Organization as org
left join Industry as ind on org.IndustryID = ind.ID
left join BusinessUnit as bu on org.BusinessUnitID = bu.ID
left join Area as area on org.AreaID = area.ID
......@@ -1020,8 +1020,8 @@ WHERE org.isactive = 1
union
select area.ID as DimensionValueID, area.Name as DimensionValueName,
area.IsActive as IsActive, 'c61a5bd6-a996-4952-9869-d053995237e6' DimensionID,
getDate() as CreateTime,
getDate() as UpdateTime
now() as CreateTime,
now() as UpdateTime
from Area as area
where area.IsActive = 1
......
......@@ -282,7 +282,7 @@
select
m.ID as ID,
m.ServiceTypeID as ServiceTypeID,
M.OrganizationID as OrganizationID,
m.OrganizationID as OrganizationID,
m.TemplateGroupID as TemplateGroupID,
t.Name as TemplateGroupName
from OrganizationServiceTemplateGroup as m
......
......@@ -13,7 +13,7 @@
<result column="MergerName" jdbcType="VARCHAR" property="mergerName" />
<result column="LevelType" jdbcType="INTEGER" property="levelType" />
<result column="TelCode" jdbcType="VARCHAR" property="telCode" />
<result column="ZipCode" jdbcType="INTEGER" property="zipCode" />
<result column="ZipCode" jdbcType="VARCHAR" property="zipCode" />
<result column="PinYin" jdbcType="VARCHAR" property="pinYin" />
<result column="Longitude" jdbcType="REAL" property="longitude" />
<result column="Latitude" jdbcType="REAL" property="latitude" />
......@@ -151,7 +151,7 @@
)
values (#{ID,jdbcType=VARCHAR}, #{parentID,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
#{shortName,jdbcType=VARCHAR}, #{mergerName,jdbcType=VARCHAR}, #{levelType,jdbcType=INTEGER},
#{telCode,jdbcType=VARCHAR}, #{zipCode,jdbcType=INTEGER}, #{pinYin,jdbcType=VARCHAR},
#{telCode,jdbcType=VARCHAR}, #{zipCode,jdbcType=VARCHAR}, #{pinYin,jdbcType=VARCHAR},
#{longitude,jdbcType=REAL}, #{latitude,jdbcType=REAL}, #{isActive,jdbcType=SMALLINT}
)
</insert>
......@@ -222,7 +222,7 @@
#{telCode,jdbcType=VARCHAR},
</if>
<if test="zipCode != null">
#{zipCode,jdbcType=INTEGER},
#{zipCode,jdbcType=VARCHAR},
</if>
<if test="pinYin != null">
#{pinYin,jdbcType=VARCHAR},
......@@ -277,7 +277,7 @@
TelCode = #{record.telCode,jdbcType=VARCHAR},
</if>
<if test="record.zipCode != null">
ZipCode = #{record.zipCode,jdbcType=INTEGER},
ZipCode = #{record.zipCode,jdbcType=VARCHAR},
</if>
<if test="record.pinYin != null">
PinYin = #{record.pinYin,jdbcType=VARCHAR},
......@@ -309,7 +309,7 @@
MergerName = #{record.mergerName,jdbcType=VARCHAR},
LevelType = #{record.levelType,jdbcType=INTEGER},
TelCode = #{record.telCode,jdbcType=VARCHAR},
ZipCode = #{record.zipCode,jdbcType=INTEGER},
ZipCode = #{record.zipCode,jdbcType=VARCHAR},
PinYin = #{record.pinYin,jdbcType=VARCHAR},
Longitude = #{record.longitude,jdbcType=REAL},
Latitude = #{record.latitude,jdbcType=REAL},
......@@ -344,7 +344,7 @@
TelCode = #{telCode,jdbcType=VARCHAR},
</if>
<if test="zipCode != null">
ZipCode = #{zipCode,jdbcType=INTEGER},
ZipCode = #{zipCode,jdbcType=VARCHAR},
</if>
<if test="pinYin != null">
PinYin = #{pinYin,jdbcType=VARCHAR},
......@@ -373,7 +373,7 @@
MergerName = #{mergerName,jdbcType=VARCHAR},
LevelType = #{levelType,jdbcType=INTEGER},
TelCode = #{telCode,jdbcType=VARCHAR},
ZipCode = #{zipCode,jdbcType=INTEGER},
ZipCode = #{zipCode,jdbcType=VARCHAR},
PinYin = #{pinYin,jdbcType=VARCHAR},
Longitude = #{longitude,jdbcType=REAL},
Latitude = #{latitude,jdbcType=REAL},
......
......@@ -306,7 +306,7 @@
<select id="selectUserRoleQueryByServiceTypeID" parameterType="java.lang.String" resultMap="UserRoleQuery">
select ur.ID as ID, u.ID as UserID, u.UserName as UserName, ur.RoleID as RoleID,
r.Name as RoleName, s.Name as ServiceTypeName, s.ID as ServiceTypeID, rc.ID as RoleCategoryID,
rc.Name as RoleCatetoryName, org.ID as OrgID, org.Name as OrgName, u.Email as Email, u.Status as Status from "USER" as u
rc.Name as RoleCatetoryName, org.ID as OrgID, org.Name as OrgName, u.Email as Email, u.Status as Status from User as u
left join UserRole as ur on u.ID = ur.UserID
left join Role as r on ur.RoleID = r.ID
left join ServiceType as s on s.ID = r.ServiceTypeID and s.IsActive = 1 and s.ID = #{serviceTypeID}
......
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