Commit 54d0facd by guojuxing

实付配置调整

parent b506bcb9
...@@ -34,6 +34,11 @@ public class DataActuallyPaidConfigDTO implements Serializable{ ...@@ -34,6 +34,11 @@ public class DataActuallyPaidConfigDTO implements Serializable{
private Integer configStatus; private Integer configStatus;
/** /**
* 1:已经配置过 0:未配置过
*/
private Integer hasConfig;
/**
* 1:有效 * 1:有效
*/ */
private Integer status; private Integer status;
...@@ -114,4 +119,13 @@ public class DataActuallyPaidConfigDTO implements Serializable{ ...@@ -114,4 +119,13 @@ public class DataActuallyPaidConfigDTO implements Serializable{
this.updateTime = updateTime; this.updateTime = updateTime;
return this; return this;
} }
public Integer getHasConfig() {
return hasConfig;
}
public DataActuallyPaidConfigDTO setHasConfig(Integer hasConfig) {
this.hasConfig = hasConfig;
return this;
}
} }
...@@ -86,20 +86,6 @@ public interface DataConfigApiService { ...@@ -86,20 +86,6 @@ public interface DataConfigApiService {
ServiceResponse<Void> configActuallyPaid(Integer enterpriseId, Integer memberBusiness, Integer performanceCount, Integer memberBusinessOfGoods); ServiceResponse<Void> configActuallyPaid(Integer enterpriseId, Integer memberBusiness, Integer performanceCount, Integer memberBusinessOfGoods);
/** /**
* 是否已经配置过会员业务(实付)
* @param enterpriseId
* @return
*/
ServiceResponse<Boolean> hasConfigMemberBusiness(Integer enterpriseId);
/**
* 是否已经配置过业绩统计(实付)
* @param enterpriseId
* @return
*/
ServiceResponse<Boolean> hasConfigPerformanceCount(Integer enterpriseId);
/**
* 实付配置信息 * 实付配置信息
* @Title: listActuallyPaidConfig
 * @Title: listActuallyPaidConfig

* @Description: * @Description:
......
...@@ -58,5 +58,5 @@ public interface TabDataActuallyPaidConfigMapper { ...@@ -58,5 +58,5 @@ public interface TabDataActuallyPaidConfigMapper {
int delete(@Param("enterpriseId") Integer enterpriseId, @Param("classify") Integer classify); int delete(@Param("enterpriseId") Integer enterpriseId, @Param("classify") Integer classify);
int count(@Param("enterpriseId") Integer enterpriseId, @Param("classify") Integer classify); TabDataActuallyPaidConfig get(@Param("enterpriseId") Integer enterpriseId, @Param("classify") Integer classify);
} }
\ No newline at end of file
...@@ -27,6 +27,11 @@ public class TabDataActuallyPaidConfig { ...@@ -27,6 +27,11 @@ public class TabDataActuallyPaidConfig {
private Integer configStatus; private Integer configStatus;
/** /**
* 1:已经配置过 0:未配置过
*/
private Integer hasConfig;
/**
* 1:有效 * 1:有效
*/ */
private Integer status; private Integer status;
...@@ -103,4 +108,13 @@ public class TabDataActuallyPaidConfig { ...@@ -103,4 +108,13 @@ public class TabDataActuallyPaidConfig {
this.updateTime = updateTime; this.updateTime = updateTime;
return this; return this;
} }
public Integer getHasConfig() {
return hasConfig;
}
public TabDataActuallyPaidConfig setHasConfig(Integer hasConfig) {
this.hasConfig = hasConfig;
return this;
}
} }
\ No newline at end of file
...@@ -17,6 +17,8 @@ public interface DataActuallyPaidConfigService { ...@@ -17,6 +17,8 @@ public interface DataActuallyPaidConfigService {

*/ 
*/
Integer saveActuallyPaidConfig(DataActuallyPaidConfigDTO dto); Integer saveActuallyPaidConfig(DataActuallyPaidConfigDTO dto);
Integer saveActuallyPaidConfig(TabDataActuallyPaidConfig dto);
/** /**
* @Title: listByEnterpriseId
 * @Title: listByEnterpriseId

* @Description: * @Description:
...@@ -38,10 +40,10 @@ public interface DataActuallyPaidConfigService { ...@@ -38,10 +40,10 @@ public interface DataActuallyPaidConfigService {
int delete(Integer enterpriseId, Integer classify); int delete(Integer enterpriseId, Integer classify);
/** /**
* 查询无效的记录,用于判断是否修改过配置,如果修改过,不允许再次edit *
* @param enterpriseId * @param enterpriseId
* @param classify * @param classify
* @return * @return
*/ */
int count(Integer enterpriseId, Integer classify); TabDataActuallyPaidConfig get(Integer enterpriseId, Integer classify);
} }
...@@ -10,6 +10,7 @@ import org.springframework.stereotype.Service; ...@@ -10,6 +10,7 @@ import org.springframework.stereotype.Service;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
@Service("dataActuallyPaidConfigService") @Service("dataActuallyPaidConfigService")
public class DataActuallyPaidConfigServiceImpl implements DataActuallyPaidConfigService{ public class DataActuallyPaidConfigServiceImpl implements DataActuallyPaidConfigService{
...@@ -28,6 +29,16 @@ public class DataActuallyPaidConfigServiceImpl implements DataActuallyPaidConfig ...@@ -28,6 +29,16 @@ public class DataActuallyPaidConfigServiceImpl implements DataActuallyPaidConfig
} }
@Override @Override
public Integer saveActuallyPaidConfig(TabDataActuallyPaidConfig dto) {
Date now = new Date();
dto.setCreateTime(now);
dto.setUpdateTime(now);
dto.setStatus(1);
tabDataActuallyPaidConfigMapper.insert(dto);
return dto.getActuallyPaidConfigId();
}
@Override
public List<TabDataActuallyPaidConfig> listByEnterpriseId(Integer enterpriseId) { public List<TabDataActuallyPaidConfig> listByEnterpriseId(Integer enterpriseId) {
return tabDataActuallyPaidConfigMapper.listByEnterpriseId(enterpriseId); return tabDataActuallyPaidConfigMapper.listByEnterpriseId(enterpriseId);
} }
...@@ -38,7 +49,7 @@ public class DataActuallyPaidConfigServiceImpl implements DataActuallyPaidConfig ...@@ -38,7 +49,7 @@ public class DataActuallyPaidConfigServiceImpl implements DataActuallyPaidConfig
} }
@Override @Override
public int count(Integer enterpriseId, Integer classify) { public TabDataActuallyPaidConfig get(Integer enterpriseId, Integer classify) {
return tabDataActuallyPaidConfigMapper.count(enterpriseId, classify); return tabDataActuallyPaidConfigMapper.get(enterpriseId, classify);
} }
} }
...@@ -124,8 +124,16 @@ public class DataConfigApiServiceImpl implements DataConfigApiService { ...@@ -124,8 +124,16 @@ public class DataConfigApiServiceImpl implements DataConfigApiService {
if (dto.getClassify() == null) { if (dto.getClassify() == null) {
dto.setClassify(1); dto.setClassify(1);
} }
if (dataActuallyPaidConfigService.count(dto.getEnterpriseId(), dto.getClassify()) > 0) { TabDataActuallyPaidConfig temp = dataActuallyPaidConfigService.get(dto.getEnterpriseId(), dto.getClassify());
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "已经配置过,不允许再次配置"); if (temp != null && temp.getHasConfig() == 1) {
//return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "已经配置过,不允许再次配置");
continue;
}
if (temp == null) {
//如果是第一次生成,则
dto.setHasConfig(0);
} else {
dto.setHasConfig(1);
} }
dataActuallyPaidConfigService.delete(dto.getEnterpriseId(), dto.getClassify()); dataActuallyPaidConfigService.delete(dto.getEnterpriseId(), dto.getClassify());
dto.setConfigStatus(Optional.ofNullable(dto.getConfigStatus()).orElse(0)); dto.setConfigStatus(Optional.ofNullable(dto.getConfigStatus()).orElse(0));
...@@ -176,16 +184,6 @@ public class DataConfigApiServiceImpl implements DataConfigApiService { ...@@ -176,16 +184,6 @@ public class DataConfigApiServiceImpl implements DataConfigApiService {
} }
@Override @Override
public ServiceResponse<Boolean> hasConfigMemberBusiness(Integer enterpriseId) {
return ServiceResponse.success(dataActuallyPaidConfigService.count(enterpriseId, 1) > 0);
}
@Override
public ServiceResponse<Boolean> hasConfigPerformanceCount(Integer enterpriseId) {
return ServiceResponse.success(dataActuallyPaidConfigService.count(enterpriseId, 3) > 0);
}
@Override
public ServiceResponse<List<DataActuallyPaidConfigDTO>> listActuallyPaidConfig(Integer enterpriseId) { public ServiceResponse<List<DataActuallyPaidConfigDTO>> listActuallyPaidConfig(Integer enterpriseId) {
List<TabDataActuallyPaidConfig> list = dataActuallyPaidConfigService.listByEnterpriseId(enterpriseId); List<TabDataActuallyPaidConfig> list = dataActuallyPaidConfigService.listByEnterpriseId(enterpriseId);
if (CollectionUtils.isEmpty(list)) { if (CollectionUtils.isEmpty(list)) {
...@@ -200,18 +198,18 @@ public class DataConfigApiServiceImpl implements DataConfigApiService { ...@@ -200,18 +198,18 @@ public class DataConfigApiServiceImpl implements DataConfigApiService {
public ServiceResponse<DataActuallyPaidConfig> getDataActuallyPaidConfig(Integer enterpriseId) { public ServiceResponse<DataActuallyPaidConfig> getDataActuallyPaidConfig(Integer enterpriseId) {
List<TabDataActuallyPaidConfig> list = dataActuallyPaidConfigService.listByEnterpriseId(enterpriseId); List<TabDataActuallyPaidConfig> list = dataActuallyPaidConfigService.listByEnterpriseId(enterpriseId);
if (CollectionUtils.isNotEmpty(list)) { if (CollectionUtils.isNotEmpty(list)) {
Map<String, Integer> map = list.stream().collect(Collectors.toMap(e -> e.getClassify().toString(), e -> e.getConfigStatus())); Map<String, TabDataActuallyPaidConfig> map = list.stream().collect(Collectors.toMap(e -> e.getClassify().toString(), e -> e));
//如果没有配置,默认数据 //如果没有配置,默认数据
Integer memberBusiness = map.get("1"); Integer memberBusiness = map.get("1").getConfigStatus();
Integer performanceCount = map.get("3"); Integer performanceCount = map.get("3").getConfigStatus();
Integer memberBusinessOfGoods = map.get("6"); Integer memberBusinessOfGoods = map.get("6").getConfigStatus();
return ServiceResponse.success(new DataActuallyPaidConfig() return ServiceResponse.success(new DataActuallyPaidConfig()
.setEnterpriseId(enterpriseId) .setEnterpriseId(enterpriseId)
.setMemberBusiness(memberBusiness) .setMemberBusiness(memberBusiness)
.setPerformanceCount(performanceCount) .setPerformanceCount(performanceCount)
.setHasConfigMemberBusiness(dataActuallyPaidConfigService.count(enterpriseId, 1) > 0) .setHasConfigMemberBusiness(map.get("1").getHasConfig() == 1)
.setHasConfigPerformanceCount(dataActuallyPaidConfigService.count(enterpriseId, 3) > 0) .setHasConfigPerformanceCount(map.get("3").getHasConfig() == 1)
.setHasConfigMemberBusinessOfGoods(dataActuallyPaidConfigService.count(enterpriseId, 6) > 0) .setHasConfigMemberBusinessOfGoods(map.get("6").getHasConfig() == 1)
.setMemberBusinessOfGoods(memberBusinessOfGoods)); .setMemberBusinessOfGoods(memberBusinessOfGoods));
} }
return ServiceResponse.success(new DataActuallyPaidConfig().setEnterpriseId(enterpriseId).setMemberBusiness(0).setPerformanceCount(0).setMemberBusinessOfGoods(0)); return ServiceResponse.success(new DataActuallyPaidConfig().setEnterpriseId(enterpriseId).setMemberBusiness(0).setPerformanceCount(0).setMemberBusinessOfGoods(0));
......
...@@ -6,12 +6,13 @@ ...@@ -6,12 +6,13 @@
<result column="enterprise_id" jdbcType="INTEGER" property="enterpriseId" /> <result column="enterprise_id" jdbcType="INTEGER" property="enterpriseId" />
<result column="classify" jdbcType="INTEGER" property="classify" /> <result column="classify" jdbcType="INTEGER" property="classify" />
<result column="config_status" jdbcType="INTEGER" property="configStatus" /> <result column="config_status" jdbcType="INTEGER" property="configStatus" />
<result column="has_config" jdbcType="INTEGER" property="hasConfig" />
<result column="status" jdbcType="INTEGER" property="status" /> <result column="status" jdbcType="INTEGER" property="status" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" /> <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
</resultMap> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
actually_paid_config_id, enterprise_id, classify, config_status, status, create_time, actually_paid_config_id, enterprise_id, classify, config_status, has_config, status, create_time,
update_time update_time
</sql> </sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap"> <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
...@@ -26,10 +27,10 @@ ...@@ -26,10 +27,10 @@
</delete> </delete>
<insert id="insert" parameterType="com.gic.enterprise.entity.TabDataActuallyPaidConfig" useGeneratedKeys="true" keyProperty="actuallyPaidConfigId"> <insert id="insert" parameterType="com.gic.enterprise.entity.TabDataActuallyPaidConfig" useGeneratedKeys="true" keyProperty="actuallyPaidConfigId">
insert into tab_data_actually_paid_config (actually_paid_config_id, enterprise_id, insert into tab_data_actually_paid_config (actually_paid_config_id, enterprise_id,
classify, config_status, status, classify, config_status, has_config, status,
create_time, update_time) create_time, update_time)
values (#{actuallyPaidConfigId,jdbcType=INTEGER}, #{enterpriseId,jdbcType=INTEGER}, values (#{actuallyPaidConfigId,jdbcType=INTEGER}, #{enterpriseId,jdbcType=INTEGER},
#{classify,jdbcType=INTEGER}, #{configStatus,jdbcType=INTEGER}, #{status,jdbcType=INTEGER}, #{classify,jdbcType=INTEGER}, #{configStatus,jdbcType=INTEGER}, #{hasConfig,jdbcType=INTEGER}, #{status,jdbcType=INTEGER},
#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}) #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP})
</insert> </insert>
<insert id="insertSelective" parameterType="com.gic.enterprise.entity.TabDataActuallyPaidConfig"> <insert id="insertSelective" parameterType="com.gic.enterprise.entity.TabDataActuallyPaidConfig">
...@@ -47,6 +48,9 @@ ...@@ -47,6 +48,9 @@
<if test="configStatus != null"> <if test="configStatus != null">
config_status, config_status,
</if> </if>
<if test="hasConfig != null">
has_config,
</if>
<if test="status != null"> <if test="status != null">
status, status,
</if> </if>
...@@ -70,6 +74,9 @@ ...@@ -70,6 +74,9 @@
<if test="configStatus != null"> <if test="configStatus != null">
#{configStatus,jdbcType=INTEGER}, #{configStatus,jdbcType=INTEGER},
</if> </if>
<if test="hasConfig != null">
#{hasConfig,jdbcType=INTEGER},
</if>
<if test="status != null"> <if test="status != null">
#{status,jdbcType=INTEGER}, #{status,jdbcType=INTEGER},
</if> </if>
...@@ -93,6 +100,9 @@ ...@@ -93,6 +100,9 @@
<if test="configStatus != null"> <if test="configStatus != null">
config_status = #{configStatus,jdbcType=INTEGER}, config_status = #{configStatus,jdbcType=INTEGER},
</if> </if>
<if test="hasConfig != null">
has_config = #{hasConfig,jdbcType=INTEGER},
</if>
<if test="status != null"> <if test="status != null">
status = #{status,jdbcType=INTEGER}, status = #{status,jdbcType=INTEGER},
</if> </if>
...@@ -110,6 +120,7 @@ ...@@ -110,6 +120,7 @@
set enterprise_id = #{enterpriseId,jdbcType=INTEGER}, set enterprise_id = #{enterpriseId,jdbcType=INTEGER},
classify = #{classify,jdbcType=INTEGER}, classify = #{classify,jdbcType=INTEGER},
config_status = #{configStatus,jdbcType=INTEGER}, config_status = #{configStatus,jdbcType=INTEGER},
has_config = #{hasConfig,jdbcType=INTEGER},
status = #{status,jdbcType=INTEGER}, status = #{status,jdbcType=INTEGER},
create_time = #{createTime,jdbcType=TIMESTAMP}, create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP} update_time = #{updateTime,jdbcType=TIMESTAMP}
...@@ -131,10 +142,10 @@ ...@@ -131,10 +142,10 @@
and status = 1 and status = 1
</update> </update>
<select id="count" resultType="int"> <select id="get" resultMap="BaseResultMap">
select count(1) from tab_data_actually_paid_config select <include refid="Base_Column_List"></include> from tab_data_actually_paid_config
where enterprise_id = #{enterpriseId} where enterprise_id = #{enterpriseId}
and classify = #{classify} and classify = #{classify}
and status = 0 and status = 1
</select> </select>
</mapper> </mapper>
\ No newline at end of file
...@@ -6,6 +6,8 @@ import java.util.Map; ...@@ -6,6 +6,8 @@ import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import com.gic.enterprise.ano.IgnoreLogin; import com.gic.enterprise.ano.IgnoreLogin;
import com.gic.enterprise.dto.EnterpriseDTO;
import com.gic.enterprise.service.EnterpriseApiService;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
...@@ -54,6 +56,8 @@ public class DataConfigController { ...@@ -54,6 +56,8 @@ public class DataConfigController {
private MemberCardApiService memberCardApiService; private MemberCardApiService memberCardApiService;
@Autowired @Autowired
private EnterpriseInitApiService enterpriseInitApiService; private EnterpriseInitApiService enterpriseInitApiService;
@Autowired
private EnterpriseApiService enterpriseApiService;
@RequestMapping("list-all-applet") @RequestMapping("list-all-applet")
...@@ -97,7 +101,16 @@ public class DataConfigController { ...@@ -97,7 +101,16 @@ public class DataConfigController {
@IgnoreLogin @IgnoreLogin
@RequestMapping("/init-actually-data-config") @RequestMapping("/init-actually-data-config")
public RestResponse initActuallyDataConfig(Integer enterpriseId) { public RestResponse initActuallyDataConfig(Integer enterpriseId) {
return ResultControllerUtils.commonResult(dataConfigApiService.initActuallyPaidData(enterpriseId)); if (enterpriseId == null) {
ServiceResponse<List<EnterpriseDTO>> result = enterpriseApiService.listEnterpriseByName(null);
if (result.isSuccess()) {
List<EnterpriseDTO> list = result.getResult();
if (CollectionUtils.isNotEmpty(list)) {
list.forEach(e -> dataConfigApiService.initActuallyPaidData(e.getEnterpriseId()));
}
}
}
return RestResponse.success();
} }
@RequestMapping("config-wechat-member") @RequestMapping("config-wechat-member")
......
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